xcursor: don't crash on broken permissions in X themes

ref #8079
This commit is contained in:
Vaxry 2024-10-12 15:18:34 +01:00
parent ee8116ac5d
commit c3f7c9bbb5

View File

@ -117,9 +117,11 @@ void CXCursorManager::loadTheme(std::string const& name, int size, float scale)
cursors = loadStandardCursors(themeName, lastLoadSize);
} else {
for (auto const& p : paths) {
auto dirCursors = loadAllFromDir(p, lastLoadSize);
std::copy_if(dirCursors.begin(), dirCursors.end(), std::back_inserter(cursors),
[this](auto const& p) { return std::none_of(cursors.begin(), cursors.end(), [&p](auto const& dp) { return dp->shape == p->shape; }); });
try {
auto dirCursors = loadAllFromDir(p, lastLoadSize);
std::copy_if(dirCursors.begin(), dirCursors.end(), std::back_inserter(cursors),
[this](auto const& p) { return std::none_of(cursors.begin(), cursors.end(), [&p](auto const& dp) { return dp->shape == p->shape; }); });
} catch (std::exception& e) { Debug::log(ERR, "XCursor path {} can't be loaded: threw error {}", p, e.what()); }
}
}