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


Ignore:
Timestamp:
2016-02-21T11:51:40+01:00 (8 years ago)
Author:
wiktorn
Message:

Divde by zero found by Coverity Scan.

See: #12350

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/NativeScaleLayer.java

    r9825 r9846  
    118118                    double factor = Math.log(step) / Math.log(ratio);
    119119                    int steps = (int) Math.round(factor);
    120                     double smallStep = Math.pow(step, 1.0/steps);
    121                     for (int j = 1; j < steps; j++) {
    122                         double intermediate = previous.scale / Math.pow(smallStep, j);
    123                         result.addScale(new Scale(intermediate, false, current.index));
     120                    if (steps != 0) {
     121                        double smallStep = Math.pow(step, 1.0/steps);
     122                        for (int j = 1; j < steps; j++) {
     123                            double intermediate = previous.scale / Math.pow(smallStep, j);
     124                            result.addScale(new Scale(intermediate, false, current.index));
     125                        }
    124126                    }
    125127                }
Note: See TracChangeset for help on using the changeset viewer.