Merge pull request #1357 from xiaoyifang/fix/dictionary-crash

fix: validate the dictionary when push it into the variable
This commit is contained in:
xiaoyifang 2024-01-04 20:39:41 +08:00 committed by GitHub
commit 730a4b24cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -45,7 +45,9 @@ Group::Group( Config::Group const & cfgGroup,
}
}
for ( const auto & dictId : dictOrderList ) {
dictionaries.push_back( groupDicts[ dictId ] );
if ( groupDicts.contains( dictId ) ) {
dictionaries.push_back( groupDicts[ dictId ] );
}
}
}

View file

@ -1652,8 +1652,8 @@ void MainWindow::updateDictionaryBar()
if ( currentId == Instances::Group::AllGroupId )
dictionaryBar.setMutedDictionaries( &cfg.mutedDictionaries );
else {
Config::Group * grp = cfg.getGroup( currentId );
dictionaryBar.setMutedDictionaries( grp ? &grp->mutedDictionaries : nullptr );
Config::Group * _grp = cfg.getGroup( currentId );
dictionaryBar.setMutedDictionaries( _grp ? &_grp->mutedDictionaries : nullptr );
}
dictionaryBar.setDictionaries( grp->dictionaries );