Changeset 17424 in josm


Ignore:
Timestamp:
2020-12-23T07:19:48+01:00 (2 months ago)
Author:
GerdP
Message:

fix #20123: "null" Preference Tab

  • log error and ignore preference is a TabPreferenceSetting which doesn't provide an icon
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java

    r17323 r17424  
    490490            if (factory != null) {
    491491                PreferenceSetting setting = factory.createPreferenceSetting();
     492                if (setting instanceof TabPreferenceSetting && ((TabPreferenceSetting) setting).getIconName() == null) {
     493                    Logging.error("Invalid setting (Icon missing): " + setting.getClass().getName());
     494                    setting = null;
     495                }
    492496                if (setting != null) {
    493497                    settings.add(setting);
     
    524528    }
    525529
    526     private String htmlTabTitle(String title, int maxWidth) {
     530    private static String htmlTabTitle(String title, int maxWidth) {
    527531        // Width is set to force left alignment, see https://stackoverflow.com/a/33781096/2257172
    528532        return "<html><div style='padding-left:5px; width:" + maxWidth + "px'>" + title + "</div></html>";
Note: See TracChangeset for help on using the changeset viewer.