Change language saving (by static analysis)
authorjohniez <johniez@johniez.cz>
Sun, 24 May 2015 19:30:28 +0000 (21:30 +0200)
committerjohniez <johniez@johniez.cz>
Sun, 24 May 2015 19:30:28 +0000 (21:30 +0200)
configtab.cc

index fa2b24c..b43b08c 100755 (executable)
@@ -125,12 +125,11 @@ void ConfigTab::openProxy() {
  * \brief Slot assigned to save button click.
  */
 void ConfigTab::saveSettings() {
-       const char* langs[5] = {"en", "cs", "ro", "pl", "lt"};
+       const char* langs[] = {"en", "cs", "ro", "pl", "lt"};
+       const unsigned langSize = sizeof(langs) / sizeof(char *);
        QSettings settings("config/global.ini", QSettings::IniFormat);
-       if(langs) {
-               settings.setValue("lang", langs[langToSave]);
-               settings.sync();
-       }
+       settings.setValue("lang", langs[langToSave % langSize]);
+       settings.sync();
 }
 
 /**