From 124666cb3854730657d490323e01eb1710a9b4f0 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Thu, 14 May 2020 12:46:37 +0530 Subject: [PATCH] Fix #571 --- src/nnn.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/nnn.c b/src/nnn.c index ba7d78b0..1f46ac79 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -3391,7 +3391,11 @@ static void savecurctx(settings *curcfg, char *path, char *curname, int r /* nex bool selmode = cfg.selmode ? TRUE : FALSE; /* Save current context */ - xstrsncpy(g_ctx[cfg.curctx].c_name, curname, NAME_MAX + 1); + if (ndents) + xstrsncpy(g_ctx[cfg.curctx].c_name, curname, NAME_MAX + 1); + else + g_ctx[cfg.curctx].c_name[0] = '\0'; + g_ctx[cfg.curctx].c_cfg = cfg; if (ctxr->c_cfg.ctxactive) { /* Switch to saved context */