From: Daniel Carl <danielcarl@gmx.de>
Date: Mon, 9 Mar 2015 20:43:37 +0000 (+0100)
Subject: Fix segfault on config file with invalid commands (#188).
X-Git-Url: https://git.owens.tech/about.html/about.html/git?a=commitdiff_plain;h=cb48fe6a7925ef745d973dc24e636dd17eee3c90;p=vimb.git

Fix segfault on config file with invalid commands (#188).

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.
---

diff --git a/src/main.c b/src/main.c
index 51c900e..c60d7a2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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