diff --git a/Shell/Shell.cpp b/Shell/Shell.cpp index adec2a70015..1344068485a 100644 --- a/Shell/Shell.cpp +++ b/Shell/Shell.cpp @@ -1047,7 +1047,7 @@ void Shell::add_entry_to_cache(const String& entry) if (match) return; - while (strcmp(cached_path[index].characters(), entry.characters()) < 0) { + while (index < cached_path.size() && strcmp(cached_path[index].characters(), entry.characters()) < 0) { index++; } cached_path.insert(index, entry);