From 6f2e4616ab4f8af060a47a4990d930b6b6bf7295 Mon Sep 17 00:00:00 2001 From: Scoopta Date: Fri, 7 Feb 2020 18:10:06 -0800 Subject: [PATCH] That's not a very effective null check --- src/wofi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wofi.c b/src/wofi.c index e09a1ef..a4cd513 100644 --- a/src/wofi.c +++ b/src/wofi.c @@ -841,6 +841,9 @@ static gint do_sort(GtkFlowBoxChild* child1, GtkFlowBoxChild* child2, gpointer d const gchar* text2 = wofi_property_box_get_property(WOFI_PROPERTY_BOX(box2), "filter"); uint64_t index1 = strtol(wofi_property_box_get_property(WOFI_PROPERTY_BOX(box1), "index"), NULL, 10); uint64_t index2 = strtol(wofi_property_box_get_property(WOFI_PROPERTY_BOX(box2), "index"), NULL, 10); + if(text1 == NULL || text2 == NULL) { + return index1 - index2; + } if(filter == NULL || strcmp(filter, "") == 0) { switch(sort_order) { case SORT_ORDER_DEFAULT: @@ -849,9 +852,6 @@ static gint do_sort(GtkFlowBoxChild* child1, GtkFlowBoxChild* child2, gpointer d return strcmp(text1, text2); } } - if(text1 == NULL || text2 == NULL) { - return index1 - index2; - } switch(matching) { case MATCHING_MODE_CONTAINS: