@@ -411,7 +411,7 @@ StelLocationMgr::StelLocationMgr()
411
411
QSettings* conf = StelApp::getInstance ().getSettings ();
412
412
413
413
// N.B. Further missing TZ names will be printed out in the log.txt. Resolve these by adding into data/timezone.tab file.
414
- loadTimeZones ();
414
+ loadTimeZoneFixes ();
415
415
416
416
loadCountries ();
417
417
loadRegions ();
@@ -1182,17 +1182,17 @@ void StelLocationMgr::loadCountries()
1182
1182
countryNameToCodeMap.insert (" Taiwan (Provice of China)" , " tw" );
1183
1183
}
1184
1184
1185
- void StelLocationMgr::loadTimeZones ()
1185
+ void StelLocationMgr::loadTimeZoneFixes ()
1186
1186
{
1187
- QString tzFilePath = StelFileMgr::findFile (tzfFileName, StelFileMgr::File );
1187
+ QString tzFilePath = StelFileMgr::findFile (tzfFileName);
1188
1188
if (tzFilePath.isEmpty ())
1189
1189
{
1190
1190
tzFilePath = StelFileMgr::findFile (tzfFileName, StelFileMgr::New);
1191
- // Create a default TZF (time zone fixes) file
1191
+ // Create a default TZF (timezone fixes) file
1192
1192
QFile tzSrc (" :/data/timezone.tab" );
1193
1193
if (!tzSrc.copy (tzFilePath))
1194
1194
{
1195
- qWarning () << " Cannot copy time zones file to " + QDir::toNativeSeparators (tzFilePath);
1195
+ qWarning () << " Cannot copy timezone fixes to " + QDir::toNativeSeparators (tzFilePath);
1196
1196
return ;
1197
1197
}
1198
1198
}
@@ -1202,8 +1202,8 @@ void StelLocationMgr::loadTimeZones()
1202
1202
{
1203
1203
locationDBToIANAtranslations.clear ();
1204
1204
QString line;
1205
- int readOk= 0 ;
1206
- locationDBToIANAtranslations. insert ( " " , " UTC " ) ;
1205
+ locationDBToIANAtranslations. insert ( " " , " UTC " ); // a first fix
1206
+ int readOk = 1 ;
1207
1207
while (!tzFile.atEnd ())
1208
1208
{
1209
1209
line = QString::fromUtf8 (tzFile.readLine ());
@@ -1219,8 +1219,11 @@ void StelLocationMgr::loadTimeZones()
1219
1219
#endif
1220
1220
1221
1221
// The first entry is the DB name, the second is as we display it in the program.
1222
- locationDBToIANAtranslations.insert (list.at (0 ).trimmed ().toLocal8Bit (), list.at (1 ).trimmed ().toLocal8Bit ());
1223
- readOk++;
1222
+ if (list.count ()==2 ) // to avoid crashes
1223
+ {
1224
+ locationDBToIANAtranslations.insert (list.at (0 ).trimmed ().toUtf8 (), list.at (1 ).trimmed ().toUtf8 ());
1225
+ readOk++;
1226
+ }
1224
1227
}
1225
1228
}
1226
1229
qDebug () << " Loaded" << readOk << " fixes for time zones" ;
0 commit comments