From 64d0eed93673a92e00a4f2cd78640d91286d9d04 Mon Sep 17 00:00:00 2001 From: Takashi Sawanaka Date: Thu, 2 Nov 2023 22:05:46 +0900 Subject: [PATCH] Fix an issue where "[F]" could be set as the file filter if no file filter was selected in the Filters dialog. --- Src/MainFrm.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/Src/MainFrm.cpp b/Src/MainFrm.cpp index 33035758939..fc7964b9ac4 100644 --- a/Src/MainFrm.cpp +++ b/Src/MainFrm.cpp @@ -2078,23 +2078,26 @@ void CMainFrame::OnToolsFilters() { String strNone = _(""); String path = fileFiltersDlg.GetSelected(); - if (path.find(strNone) != String::npos) + if (!path.empty()) { - // Don't overwrite mask we already have - if (!pGlobalFileFilter->IsUsingMask()) + if (path.find(strNone) != String::npos) { - String sFilter(_T("*.*")); - pGlobalFileFilter->SetFilter(sFilter); + // Don't overwrite mask we already have + if (!pGlobalFileFilter->IsUsingMask()) + { + String sFilter(_T("*.*")); + pGlobalFileFilter->SetFilter(sFilter); + GetOptionsMgr()->SaveOption(OPT_FILEFILTER_CURRENT, sFilter); + } + } + else + { + pGlobalFileFilter->SetFileFilterPath(path); + pGlobalFileFilter->UseMask(false); + String sFilter = pGlobalFileFilter->GetFilterNameOrMask(); GetOptionsMgr()->SaveOption(OPT_FILEFILTER_CURRENT, sFilter); } } - else - { - pGlobalFileFilter->SetFileFilterPath(path); - pGlobalFileFilter->UseMask(false); - String sFilter = pGlobalFileFilter->GetFilterNameOrMask(); - GetOptionsMgr()->SaveOption(OPT_FILEFILTER_CURRENT, sFilter); - } bool linefiltersEnabled = lineFiltersDlg.m_bIgnoreRegExp; GetOptionsMgr()->SaveOption(OPT_LINEFILTER_ENABLED, linefiltersEnabled);