Merge pull request #279 from jelly/segfault-backspace-url-hints-mode

Add a null check when pressing backspace
This commit is contained in:
Daniel Micay 2016-01-08 16:23:06 -05:00
commit 2781c71e54
1 changed files with 1 additions and 1 deletions

View File

@ -948,7 +948,7 @@ gboolean entry_key_press_cb(GtkEntry *entry, GdkEventKey *event, keybind_info *i
} }
switch (event->keyval) { switch (event->keyval) {
case GDK_KEY_BackSpace: case GDK_KEY_BackSpace:
if (info->panel.mode == overlay_mode::urlselect) { if (info->panel.mode == overlay_mode::urlselect && info->panel.fulltext) {
size_t slen = strlen(info->panel.fulltext); size_t slen = strlen(info->panel.fulltext);
if (info->panel.fulltext != nullptr && slen > 0) if (info->panel.fulltext != nullptr && slen > 0)
info->panel.fulltext[slen-1] = '\0'; info->panel.fulltext[slen-1] = '\0';