[gtranslator] Do not use g_return_if_fail in sort_by_activated



commit 6668946ea19ea4838c639d0d4b96b237ca852dfd
Author: Daniel GarcĂ­a Moreno <dani danigm net>
Date:   Sat Sep 18 11:46:33 2021 +0200

    Do not use g_return_if_fail in sort_by_activated
    
    Check the pointers with just an if instead of using the g_return_if_fail
    to avoid showing a critical warning when it's a controlled issue.
    
    Fix https://gitlab.gnome.org/GNOME/gtranslator/-/issues/137

 src/gtr-application.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/gtr-application.c b/src/gtr-application.c
index b52202d3..074335c7 100644
--- a/src/gtr-application.c
+++ b/src/gtr-application.c
@@ -576,9 +576,9 @@ sort_by_activated (GSimpleAction *action,
   sortby = g_variant_get_int32 (st);
 
   w = GTR_WINDOW (priv->active_window);
-  g_return_if_fail (w != NULL);
+  if (!w) return;
   tab = gtr_window_get_active_tab (w);
-  g_return_if_fail (tab != NULL);
+  if (!tab) return;
   gtr_tab_sort_by (tab, (GtrMessageTableSortBy)sortby);
   gtr_window_hide_sort_menu (w);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]