Changeset 18731 in osm for applications


Ignore:
Timestamp:
2009-11-21T20:10:36+01:00 (15 years ago)
Author:
dhansen
Message:

Fixes null pointer error when snapping to tile size.

This is a race that can occur when the user rezooms
then clicks on a tile before any have been drawn.

It can also happen when not autoloading tiles.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapLayer.java

    r18727 r18731  
    216216                new AbstractAction(tr("Snap to tile size")) {
    217217                    public void actionPerformed(ActionEvent ae) {
     218                        if (lastImageScale == null) {
     219                            out("please wait for a tile to be loaded before snapping");
     220                            return;
     221                        }
    218222                        double new_factor = Math.sqrt(lastImageScale);
    219223                        if (debug)
     
    628632                continue;
    629633            drawImageInside(g, img, sourceRect, borderRect);
    630             if (autoZoomEnabled() &&
    631                 !imageScaleRecorded && zoom == currentZoomLevel) {
     634            if (!imageScaleRecorded && zoom == currentZoomLevel) {
    632635                lastImageScale = new Double(getImageScaling(img, sourceRect));
    633636                imageScaleRecorded = true;
Note: See TracChangeset for help on using the changeset viewer.