From 91381546d5fc6231de011c3863ad1d41c33c5a47 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Wed, 16 Oct 2024 00:41:28 +0300 Subject: [PATCH] Shell: Don't crash if history file does not exist :D --- userspace/programs/Shell/Input.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/userspace/programs/Shell/Input.cpp b/userspace/programs/Shell/Input.cpp index 12318be1d2..16e7535d22 100644 --- a/userspace/programs/Shell/Input.cpp +++ b/userspace/programs/Shell/Input.cpp @@ -707,7 +707,7 @@ Input::Input() FILE* history_fp = fopen(s_history_path.data(), "r"); if (history_fp == nullptr) - return; + goto history_initialized; char buffer[128]; BAN::String current_line; @@ -733,6 +733,7 @@ Input::Input() s_history.remove(0); } } +history_initialized: m_buffers = s_history; MUST(m_buffers.emplace_back(""_sv));