Fix segfault on config file with invalid commands (#188).
authorDaniel Carl <danielcarl@gmx.de>
Mon, 9 Mar 2015 20:43:37 +0000 (21:43 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Mon, 9 Mar 2015 20:46:25 +0000 (21:46 +0100)
In case the file contained invalid commands, this was shown to the user by
using vb_echo() which writes the error message into the inpubox. But this
triggered the already buffer_changed_cb that delegated the changed buffer
event to the current mode.
Long story short, there was no current mode set before which caused the
segfault.

src/main.c

index 51c900e..c60d7a2 100644 (file)
@@ -1029,6 +1029,9 @@ static void init_core(void)
 #endif
     map_init();
 
+    /* enter normal mode */
+    vb_enter('n');
+
     setup_signals();
 
     /* make sure the main window and all its contents are visible */
@@ -1050,9 +1053,6 @@ static void init_core(void)
         g_object_set(G_OBJECT(setting), "enable-default-context-menu", false, NULL);
     }
 
-    /* enter normal mode */
-    vb_enter('n');
-
     vb.config.default_zoom = 1.0;
 
 #ifdef FEATURE_HIGH_DPI