Add a null check when pressing backspace

Closes: #270
This commit is contained in:
Jelle van der Waa 2016-01-08 22:20:00 +01:00
parent 22c11916a3
commit 20c9500fbe
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';