Skip to content

Commit

Permalink
[QMS-204] Garmin Map: Fix crash because of bad codec number
Browse files Browse the repository at this point in the history
If the typ file has a bad codec number for UTF8 the code will be
a nullptr. As a consequence the pointer ahs to be tested befor
it is used.
  • Loading branch information
kiozen committed Jun 9, 2020
1 parent 00f4e35 commit 4d275a2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ V1.XX.X
[QMS-183] Backward range selection causing small issues
[QMS-192] Fix URLs still pointing to the bitbucket wiki
[QMS-201] Fix GDAL deprecation warnings
[QMS-204] Garmin Map: Fix crash because of bad codec number

V1.14.1
[QMS-37] Inconsistent use of time zones
Expand Down
15 changes: 12 additions & 3 deletions src/qmapshack/map/garmin/CGarminTyp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,10 @@ bool CGarminTyp::parsePolygon(QDataStream& in, QMap<quint32, polygon_property>&

str += t8;
}
property.strings[langcode] = codec->toUnicode(str);
if(codec != nullptr)
{
property.strings[langcode] = codec->toUnicode(str);
}
#ifdef DBG
qDebug() << len << langcode << property.strings[langcode];
#endif
Expand Down Expand Up @@ -894,7 +897,10 @@ bool CGarminTyp::parsePolyline(QDataStream& in, QMap<quint32, polyline_property>

str += t8_1;
}
property.strings[langcode] = codec->toUnicode(str);
if(codec != nullptr)
{
property.strings[langcode] = codec->toUnicode(str);
}
#ifdef DBG
qDebug() << len << langcode << property.strings[langcode];
#endif
Expand Down Expand Up @@ -1298,7 +1304,10 @@ bool CGarminTyp::parsePoint(QDataStream& in, QMap<quint32, point_property>& poin

str += t8_1;
}
property.strings[langcode] = codec->toUnicode(str);
if(codec != nullptr)
{
property.strings[langcode] = codec->toUnicode(str);
}
#ifdef DBG
qDebug() << len << langcode << property.strings[langcode];
#endif
Expand Down

0 comments on commit 4d275a2

Please sign in to comment.