Ignore:
Timestamp:
2020-06-10T08:04:42+02:00 (4 years ago)
Author:
simon04
Message:

fix #19197 - MapCSS JOSM_pref: check if a pref could be converted to a color instead of a string (patch by taylor.smock, modified)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java

    r16553 r16590  
    2828import org.openstreetmap.josm.data.osm.search.SearchCompiler.Match;
    2929import org.openstreetmap.josm.data.osm.search.SearchParseError;
     30import org.openstreetmap.josm.data.preferences.NamedColorProperty;
    3031import org.openstreetmap.josm.gui.MainApplication;
    3132import org.openstreetmap.josm.gui.mappaint.Cascade;
     
    768769     * Obtains the JOSM'key {@link org.openstreetmap.josm.data.Preferences} string for key {@code key},
    769770     * and defaults to {@code def} if that is null.
     771     *
     772     * If the default value can be {@linkplain Cascade#convertTo converted} to a {@link Color},
     773     * the {@link NamedColorProperty} is retrieved as string.
     774     *
    770775     * @param env the environment
    771776     * @param key Key in JOSM preference
     
    774779     */
    775780    public static String JOSM_pref(Environment env, String key, String def) { // NO_UCD (unused code)
    776         return MapPaintStyles.getStyles().getPreferenceCached(key, def);
     781        return MapPaintStyles.getStyles().getPreferenceCached(env != null ? env.source : null, key, def);
    777782    }
    778783
Note: See TracChangeset for help on using the changeset viewer.