mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
Avoid assert by verifying installed languages exist (#1354)
wxDir::GetAllFiles will throw an assert when opening the preferences dialog if for some reason the user has not installed VeraCrypt properly and is missing the intended folder. This patch adds a check to ensure the folder first exists before querying its files.
This commit is contained in:
@@ -82,14 +82,16 @@ namespace VeraCrypt
|
|||||||
LanguageListBox->Append("System default");
|
LanguageListBox->Append("System default");
|
||||||
LanguageListBox->Append("English");
|
LanguageListBox->Append("English");
|
||||||
|
|
||||||
size_t langCount;
|
if (wxDir::Exists(languagesFolder.GetName())) {
|
||||||
langCount = wxDir::GetAllFiles(languagesFolder.GetName(), &langArray, wxEmptyString, wxDIR_FILES);
|
size_t langCount;
|
||||||
for (size_t i = 0; i < langCount; ++i) {
|
langCount = wxDir::GetAllFiles(languagesFolder.GetName(), &langArray, wxEmptyString, wxDIR_FILES);
|
||||||
wxFileName filename(langArray[i]);
|
for (size_t i = 0; i < langCount; ++i) {
|
||||||
wxString langId = filename.GetName().AfterLast('.');
|
wxFileName filename(langArray[i]);
|
||||||
wxString langNative = langEntries[langId];
|
wxString langId = filename.GetName().AfterLast('.');
|
||||||
if (!langNative.empty()) {
|
wxString langNative = langEntries[langId];
|
||||||
LanguageListBox->Append(langNative);
|
if (!langNative.empty()) {
|
||||||
|
LanguageListBox->Append(langNative);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user