From 486f63f2d8673d191cb313b6bb8290796e646536 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Mon, 11 Sep 2023 18:47:56 -0600 Subject: [PATCH] bspfile.cc: fix infinite loop --- common/bspfile.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/bspfile.cc b/common/bspfile.cc index 2616f0be..e16b27e8 100644 --- a/common/bspfile.cc +++ b/common/bspfile.cc @@ -1517,7 +1517,9 @@ public: bool found_maps_folder = false; fs::path olddir = gamedir = source; - while (!gamedir.empty()) { + // NOTE: parent_path() of C:/ is C:/ and this is considered non-empty + // its relative_path() (the part after the drive letter) is empty, though + while (!gamedir.relative_path().empty()) { gamedir = fs::weakly_canonical(gamedir).parent_path(); if (string_iequals(gamedir.filename().generic_string(), MAPS_FOLDER)) {