Skip to content

Commit

Permalink
fix(traffic signs): hide traffic signs with unkown icons
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerome Pietri committed Oct 10, 2019
1 parent 2dbec54 commit 25cb836
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,13 @@ public void finishDownload(boolean replaceMapObjects) {
synchronized (objects) {
for (MapObject object : objects) {
if (!scaledIcons.containsKey(object.getValue())) {
scaledIcons.put(
object.getValue(),
ImageUtil.scaleImageIcon(MapObject.getIcon(object.getValue()), MapillaryProperties.MAPOBJECT_ICON_SIZE.get())
);
ImageIcon icon = MapObject.getIcon(object.getValue());
if (icon != null) {
scaledIcons.put(
object.getValue(),
ImageUtil.scaleImageIcon(icon, MapillaryProperties.MAPOBJECT_ICON_SIZE.get())
);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ public static ImageIcon getIcon(final String objectTypeID) {
MapObjectIconCache.getInstance().put(objectTypeID, downloadedIcon);
return downloadedIcon;
} catch (IOException e) {
Logging.log(Logging.LEVEL_WARN, "Failed to download icon " + objectTypeID, e);
return ICON_UNKNOWN_TYPE;
Logging.log(Logging.LEVEL_WARN, "Failed to download icon. ID unknown to the icon list: " + objectTypeID, e);
// In order to not display the objects without known icons:
return null;
}
}
return cachedIcon;
Expand Down

0 comments on commit 25cb836

Please sign in to comment.