Command-line utility: avoid NULL dereference when displaying string config settings
authorSteven Luo <steven+maemo@steven676.net>
Sun, 30 May 2010 08:51:42 +0000 (01:51 -0700)
committerSteven Luo <steven+maemo@steven676.net>
Sun, 30 May 2010 08:51:42 +0000 (01:51 -0700)
config-ui/browser-switchboard-config.c

index befc113..ec1e509 100644 (file)
@@ -49,7 +49,8 @@ static int get_config_value(char *name) {
                i = optinfo - swb_config_options;
                switch (optinfo->type) {
                  case SWB_CONFIG_OPT_STRING:
                i = optinfo - swb_config_options;
                switch (optinfo->type) {
                  case SWB_CONFIG_OPT_STRING:
-                       printf("%s\n", *(char **)cfg.entries[i]);
+                       if (*(char **)cfg.entries[i])
+                               printf("%s\n", *(char **)cfg.entries[i]);
                        break;
                  case SWB_CONFIG_OPT_INT:
                        printf("%d\n", *(int *)cfg.entries[i]);
                        break;
                  case SWB_CONFIG_OPT_INT:
                        printf("%d\n", *(int *)cfg.entries[i]);