FIX: PrinterFileSystem crash when switch file type

Change-Id: I25b0659d7a33bda5bb1157c967dac300b41696a9
Github: 2633
This commit is contained in:
chunmao.guo 2023-10-07 10:42:11 +08:00 committed by Lane.Wei
parent a004356fdc
commit 92ba240173
2 changed files with 8 additions and 3 deletions

View file

@ -91,6 +91,7 @@ void PrinterFileSystem::SetFileType(FileType type, std::string const &storage)
m_file_list.swap(m_file_list_cache[{m_file_type, m_file_storage}]);
m_lock_start = m_lock_end = 0;
BuildGroups();
UpdateGroupSelect();
SendChangedEvent(EVT_FILE_CHANGED);
if (type == F_INVALID_TYPE)
return;
@ -515,10 +516,10 @@ void PrinterFileSystem::Stop(bool quit)
void PrinterFileSystem::BuildGroups()
{
if (m_file_list.empty())
return;
m_group_year.clear();
m_group_month.clear();
if (m_file_list.empty())
return;
wxDateTime t = wxDateTime((time_t) m_file_list.front().time);
m_group_year.push_back(0);
m_group_month.push_back(0);