From 3bfcacb9dc3f2adf5a13e42ca5f96d0784f81392 Mon Sep 17 00:00:00 2001 From: Earsuit Date: Thu, 7 Nov 2024 21:37:33 +0800 Subject: [PATCH] fix: prevent crash if there is no onedrive in the system --- ImFileDialog.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ImFileDialog.cpp b/ImFileDialog.cpp index 8523d5b..33e2039 100644 --- a/ImFileDialog.cpp +++ b/ImFileDialog.cpp @@ -588,8 +588,10 @@ namespace ifd { m_treeCache.emplace_back(std::move(quickAccess)); // OneDrive - auto oneDrive = std::make_unique(_wgetenv(L"OneDriveConsumer")); - m_treeCache.emplace_back(std::move(oneDrive)); + if (auto oneDrivePath = _wgetenv(L"OneDrive"); oneDrivePath != nullptr) { + auto oneDrive = std::make_unique(oneDrivePath); + m_treeCache.emplace_back(std::move(oneDrive)); + } // This PC auto thisPC = std::make_unique("This PC");