VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main
diff options
context:
space:
mode:
authorJertzukka <Jertzukka@gmail.com>2024-06-04 00:10:53 +0300
committerGitHub <noreply@github.com>2024-06-03 23:10:53 +0200
commitbf9f3ec4f0a987ae1591ab5466f6eee599203c85 (patch)
tree9ae40f3a2f890603129efecfdb2f7d9cd3f7107a /src/Main
parentea7489b93bca1476fd485982ebce8a1b11284ae9 (diff)
downloadVeraCrypt-bf9f3ec4f0a987ae1591ab5466f6eee599203c85.tar.gz
VeraCrypt-bf9f3ec4f0a987ae1591ab5466f6eee599203c85.zip
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.
Diffstat (limited to 'src/Main')
-rw-r--r--src/Main/Forms/PreferencesDialog.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/Main/Forms/PreferencesDialog.cpp b/src/Main/Forms/PreferencesDialog.cpp
index 90a668e6..c4d5140f 100644
--- a/src/Main/Forms/PreferencesDialog.cpp
+++ b/src/Main/Forms/PreferencesDialog.cpp
@@ -82,14 +82,16 @@ namespace VeraCrypt
LanguageListBox->Append("System default");
LanguageListBox->Append("English");
- size_t langCount;
- langCount = wxDir::GetAllFiles(languagesFolder.GetName(), &langArray, wxEmptyString, wxDIR_FILES);
- for (size_t i = 0; i < langCount; ++i) {
- wxFileName filename(langArray[i]);
- wxString langId = filename.GetName().AfterLast('.');
- wxString langNative = langEntries[langId];
- if (!langNative.empty()) {
- LanguageListBox->Append(langNative);
+ if (wxDir::Exists(languagesFolder.GetName())) {
+ size_t langCount;
+ langCount = wxDir::GetAllFiles(languagesFolder.GetName(), &langArray, wxEmptyString, wxDIR_FILES);
+ for (size_t i = 0; i < langCount; ++i) {
+ wxFileName filename(langArray[i]);
+ wxString langId = filename.GetName().AfterLast('.');
+ wxString langNative = langEntries[langId];
+ if (!langNative.empty()) {
+ LanguageListBox->Append(langNative);
+ }
}
}
#endif