diff options
author | portix <none@none> | 2012-08-25 01:14:26 +0200 |
---|---|---|
committer | portix <none@none> | 2012-08-25 01:14:26 +0200 |
commit | 5eee790c23ba4f6943a9d6951598b02258eedf49 (patch) | |
tree | f865a3e8fff5e401de29fd7e336706502896c085 | |
parent | 469e4c6b23c01bf4f1087776d6951412e32e0d57 (diff) | |
download | dwb-5eee790c23ba4f6943a9d6951598b02258eedf49.zip |
Check if key or value is NULL in dwb_set_key
-rw-r--r-- | src/dwb.c | 10 | ||||
-rw-r--r-- | src/dwb.h | 2 |
2 files changed, 8 insertions, 4 deletions
@@ -1263,9 +1263,11 @@ dwb_set_setting(const char *key, char *value, int scope) { }/*}}}*/ /* dwb_set_key(const char *prop, char *val) {{{*/ -void +DwbStatus dwb_set_key(const char *prop, char *val) { KeyValue value; + if (prop == NULL || val == NULL) + return STATUS_ERROR; value.id = g_strdup(prop); if (val) @@ -1280,6 +1282,7 @@ dwb_set_key(const char *prop, char *val) { dwb.keymap = dwb_keymap_add(dwb.keymap, value); dwb.keymap = g_list_sort(dwb.keymap, (GCompareFunc)util_keymap_sort_second); dwb_save_key_value(dwb.files[FILES_KEYS], prop, val); + return STATUS_OK; }/*}}}*/ /* dwb_get_host(WebKitWebView *) {{{*/ @@ -2300,6 +2303,7 @@ dwb_parse_nummod(const char *text) { gboolean /* dwb_entry_activate (GdkEventKey *e) {{{*/ dwb_entry_activate(GdkEventKey *e) { char **token = NULL; + gboolean status; switch (CLEAN_MODE(dwb.state.mode)) { case HINT_MODE: dwb_update_hints(e); return false; case FIND_MODE: dwb_focus_scroll(dwb.state.fview); @@ -2317,8 +2321,8 @@ dwb_entry_activate(GdkEventKey *e) { g_strfreev(token); return true; case KEY_MODE: token = g_strsplit(GET_TEXT(), " ", 2); - dwb_set_key(token[0], token[1]); - dwb_change_mode(NORMAL_MODE, false); + status = dwb_set_key(token[0], token[1]); + dwb_change_mode(NORMAL_MODE, status == STATUS_ERROR); g_strfreev(token); return true; case COMMAND_MODE: if (dwb.state.mode & COMPLETION_MODE) @@ -905,7 +905,7 @@ gboolean dwb_toggle_allowed(const char *, const char *, GList **); char * dwb_get_host(WebKitWebView *); gboolean dwb_focus_view(GList *); void dwb_clean_key_buffer(void); -void dwb_set_key(const char *, char *); +DwbStatus dwb_set_key(const char *, char *); DwbStatus dwb_set_setting(const char *, char *value, int); DwbStatus dwb_toggle_setting(const char *, int ); DwbStatus dwb_open_startpage(GList *); |