]> Sergey Matveev's repositories - nnn.git/commitdiff
Fix #315: crash is NNN_BMS is not set
authorArun Prakash Jana <engineerarun@gmail.com>
Wed, 7 Aug 2019 20:09:41 +0000 (01:39 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Wed, 7 Aug 2019 20:09:41 +0000 (01:39 +0530)
src/nnn.c

index 62c78c0c9747d2bf312255d0bf66198be9b5f1ee..c3997911f7735bb23f00e2ce97a142e9bb22aa11 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2074,13 +2074,16 @@ static int xlink(char *suffix, char *path, char *buf, int *presel, int type)
 static bool parsebmstr(void)
 {
        int i = 0;
-       bmstr = strdup(getenv(env_cfg[NNN_BMS]));
-       char *bms = bmstr;
-       char *nextkey = bms;
+       char *nextkey;
+       char *bms = getenv(env_cfg[NNN_BMS]);
 
        if (!bms || !*bms)
                return TRUE;
 
+       bmstr = strdup(bms);
+       bms = bmstr;
+       nextkey = bms;
+
        while (*bms && i < BM_MAX) {
                if (bms == nextkey) {
                        bookmark[i].key = *bms;