diff --git a/lib/cli/consolecommand.cpp b/lib/cli/consolecommand.cpp index 98d120cf9..5da45da65 100644 --- a/lib/cli/consolecommand.cpp +++ b/lib/cli/consolecommand.cpp @@ -271,9 +271,11 @@ incomplete: if (commandOnce.IsEmpty()) { add_history(cline); - historyfp.open(historyPath.CStr(), std::fstream::out | std::fstream::app); - historyfp << cline << "\n"; - historyfp.close(); + if (cline[0] != '\0') { + historyfp.open(historyPath.CStr(), std::fstream::out | std::fstream::app); + historyfp << cline << "\n"; + historyfp.close(); + } } line = cline;