Changeset 9229 in josm for trunk/src/org


Ignore:
Timestamp:
2015-12-31T13:54:58+01:00 (9 years ago)
Author:
Don-vip
Message:

fix #12262 - NPE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/ColorHelper.java

    r9223 r9229  
    8282    public static Color getForegroundColor(Color bg) {
    8383        // http://stackoverflow.com/a/3943023/2257172
    84         return (bg.getRed()*0.299 + bg.getGreen()*0.587 + bg.getBlue()*0.114) > 186 ?
    85                 Color.BLACK : Color.WHITE;
     84        return bg == null ? null :
     85              (bg.getRed()*0.299 + bg.getGreen()*0.587 + bg.getBlue()*0.114) > 186 ?
     86                  Color.BLACK : Color.WHITE;
    8687    }
    8788}
Note: See TracChangeset for help on using the changeset viewer.