ui/common/context.c

changeset 121
1cc365c34125
parent 111
40dbf1a7526a
child 128
c284c15509a8
--- a/ui/common/context.c	Wed Jan 27 20:55:37 2016 +0100
+++ b/ui/common/context.c	Fri Jan 29 18:48:56 2016 +0100
@@ -432,6 +432,10 @@
 }
 
 int* ui_active_groups(UiContext *ctx, int *ngroups) {
+    if(!ctx->groups) {
+        return NULL;
+    }
+    
     int nelm = ucx_list_size(ctx->groups);
     int *groups = calloc(sizeof(int), nelm);
     
@@ -470,7 +474,9 @@
         ui_set_enabled(gw->widget, enable);
     }
     
-    free(groups);
+    if(groups) {
+        free(groups);
+    }
 }
 
 void uic_add_group_widget(UiContext *ctx, void *widget, UcxList *groups) {

mercurial