diff --git a/tableview/src/main/java/de/codecrafters/tableview/SortableTableView.java b/tableview/src/main/java/de/codecrafters/tableview/SortableTableView.java index 2304f19..789c44c 100644 --- a/tableview/src/main/java/de/codecrafters/tableview/SortableTableView.java +++ b/tableview/src/main/java/de/codecrafters/tableview/SortableTableView.java @@ -190,7 +190,7 @@ private class SortingController implements TableHeaderClickListener { @Override public void onHeaderClicked(final int columnIndex) { - if (comparators.get(columnIndex) != null) { + if (comparators.get(columnIndex) == null) { Log.i(LOG_TAG, "Unable to sort column with index " + columnIndex + ". Reason: no comparator set for this column."); return; } @@ -203,7 +203,7 @@ public void onHeaderClicked(final int columnIndex) { } public void sort(final int columnIndex, final boolean sortUp) { - if (comparators.get(columnIndex) != null) { + if (comparators.get(columnIndex) == null) { Log.i(LOG_TAG, "Unable to sort column with index " + columnIndex + ". Reason: no comparator set for this column."); return; }