Suggestion: replace with if (this.matrix.getRowCount() > 0)