diff --git a/Vector.java b/Vector.java index a8087a7..c63156c 100644 --- a/Vector.java +++ b/Vector.java @@ -47,19 +47,26 @@ public class Vector { } public static int[][] matrixMultiplication(int[][] matrix, int scalar) { - int[][] ausgabe = null; + int[][] ausgabe; // boolean matrixFlag = false; // if (matrix.length ==3 && matrix[0].length == 3 && matrix[1].length == 3 && // matrix[2].length == 3){ // matrixFlag =true; // } - if (matrix.length == 3 && matrix[0].length == 3 && matrix[1].length == 3 && matrix[2].length == 3) { + if (matrix == null){ + ausgabe = null; + } + else if (matrix.length == 3 && matrix[0].length == 3 && matrix[1].length == 3 && matrix[2].length == 3) { ausgabe = new int[3][3]; for (int außenPos = 0; außenPos < matrix.length; außenPos++) { for (int innenPos = 0; innenPos < matrix[außenPos].length; innenPos++) { ausgabe[außenPos][innenPos] = matrix[außenPos][innenPos] * scalar; } } + + } + else { + ausgabe = null; } return ausgabe;