Fix for Projection.equals fails when passed 'null'. r=pagameba
(Closes #1286) git-svn-id: http://svn.openlayers.org/trunk/openlayers@5825 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -89,7 +89,11 @@ OpenLayers.Projection = OpenLayers.Class({
|
||||
* {Boolean} The two projections are equivalent.
|
||||
*/
|
||||
equals: function(projection) {
|
||||
return this.getCode() == projection.getCode();
|
||||
if (projection && projection.getCode) {
|
||||
return this.getCode() == projection.getCode();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
/* Method: destroy
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
out = OpenLayers.Projection.transform({'x':10,'y':12}, projection, projection2);
|
||||
t.eq(out.x, 10, "Null transform has no effect");
|
||||
t.eq(out.y, 12, "Null transform has no effect");
|
||||
|
||||
t.eq(projection.equals(null), false, "equals on null projection returns false");
|
||||
t.eq(projection.equals({}), false, "equals on null projection object returns false (doesn't call getCode)");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user