diff --git a/Source/NimbleCommander/NimbleCommander/Core/Theming/Theme.mm b/Source/NimbleCommander/NimbleCommander/Core/Theming/Theme.mm index f8d219cdd..0b3b861fb 100644 --- a/Source/NimbleCommander/NimbleCommander/Core/Theming/Theme.mm +++ b/Source/NimbleCommander/NimbleCommander/Core/Theming/Theme.mm @@ -1,4 +1,4 @@ -// Copyright (C) 2016-2022 Michael Kazakov. Subject to GNU General Public License version 3. +// Copyright (C) 2016-2024 Michael Kazakov. Subject to GNU General Public License version 3. #include "Theme.h" #include #include "ThemePersistence.h" @@ -118,12 +118,15 @@ ? [NSAppearance appearanceNamed:NSAppearanceNameAqua] : [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua]; - auto cr = &doc.FindMember("filePanelsColoringRules_v1")->value; - if( cr->IsArray() ) - for( auto i = cr->Begin(), e = cr->End(); i != e; ++i ) { - auto rule = nc::panel::PresentationItemsColoringRulePersistence{}.FromJSON(*i); - I->m_ColoringRules.emplace_back(std::move(rule)); + if( const auto rules_it = doc.FindMember("filePanelsColoringRules_v1"); rules_it != doc.MemberEnd() ) { + if( const auto &cr = rules_it->value; cr.IsArray() ) { + for( auto i = cr.Begin(), e = cr.End(); i != e; ++i ) { + auto rule = nc::panel::PresentationItemsColoringRulePersistence{}.FromJSON(*i); + I->m_ColoringRules.emplace_back(std::move(rule)); + } } + } + // always have a default ("others") non-filtering filter at the back I->m_ColoringRules.emplace_back(); diff --git a/Source/VFS/tests/VFSArchive_UT.cpp b/Source/VFS/tests/VFSArchive_UT.cpp index a83b4f065..bd638a5a6 100644 --- a/Source/VFS/tests/VFSArchive_UT.cpp +++ b/Source/VFS/tests/VFSArchive_UT.cpp @@ -214,7 +214,7 @@ TEST_CASE(PREFIX "Can unzip an archive with Cyrillic symbols") auto bytes = file->ReadFile(); REQUIRE(bytes); REQUIRE(bytes->size() == 3); - CHECK(std::memcmp(bytes->data(), "123", 4) == 0); + CHECK(std::memcmp(bytes->data(), "123", 3) == 0); }; check({reinterpret_cast(__1_zip), __1_zip_len}); check({reinterpret_cast(__2_zip), __2_zip_len});