Changeset 13657 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2018-04-22T02:41:42+02:00 (18 months ago)
Author:
Don-vip
Message:

fix #16212 - NPE

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r13649 r13657  
    440440                }
    441441            } else {
    442                 Image img = fillImage.getImage(disabled);
    443                 // TexturePaint requires BufferedImage -> get base image from
    444                 // possible multi-resolution image
    445                 img = HiDPISupport.getBaseImage(img);
    446                 TexturePaint texture = new TexturePaint((BufferedImage) img,
    447                         new Rectangle(0, 0, fillImage.getWidth(), fillImage.getHeight()));
    448                 g.setPaint(texture);
     442                // TexturePaint requires BufferedImage -> get base image from possible multi-resolution image
     443                Image img = HiDPISupport.getBaseImage(fillImage.getImage(disabled));
     444                if (img != null) {
     445                    g.setPaint(new TexturePaint((BufferedImage) img,
     446                            new Rectangle(0, 0, fillImage.getWidth(), fillImage.getHeight())));
     447                } else {
     448                    Logging.warn("Unable to get image from " + fillImage);
     449                }
    449450                Float alpha = fillImage.getAlphaFloat();
    450451                if (!Utils.equalsEpsilon(alpha, 1f)) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/MapImage.java

    r13252 r13657  
    112112    private Image getDisabled() {
    113113        if (disabledImgCache != null)
    114                 return disabledImgCache;
     114            return disabledImgCache;
    115115        if (img == null)
    116116            getImage(); // fix #7498 ?
Note: See TracChangeset for help on using the changeset viewer.