Merge pull request #1406 from Spiffyk/language-segfault

sway/language: fix segmentation fault for layouts not found in XKBContext
This commit is contained in:
Alex 2022-01-25 23:08:32 +01:00 committed by GitHub
commit 96caa9f094
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -154,7 +154,10 @@ auto Language::init_layouts_map(const std::vector<std::string>& used_layouts) ->
std::map<std::string, int> short_name_to_number_map;
for (const auto& used_layout_name : used_layouts) {
auto used_layout = &layouts_map_.find(used_layout_name)->second;
auto found = layouts_map_.find(used_layout_name);
if (found == layouts_map_.end())
continue;
auto used_layout = &found->second;
auto layouts_with_same_name_list = found_by_short_names[used_layout->short_name];
if (layouts_with_same_name_list.size() < 2) {
continue;