OpenLayers OpenLayers

Changeset 7943

Show
Ignore:
Timestamp:
09/03/08 22:19:41 (3 months ago)
Author:
euzuro
Message:

fixing regression committed in r5280. applyDefaults() again allows for an undefined value as the 'from' parameter. thanks tim for report and review. (Closes #1716)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Util.js

    r7888 r7943  
    564564     * the source has its own toString property. 
    565565     */ 
    566     if(!fromIsEvt && from.hasOwnProperty 
     566    if(!fromIsEvt && from && from.hasOwnProperty 
    567567       && from.hasOwnProperty('toString') && !to.hasOwnProperty('toString')) { 
    568568        to.toString = from.toString; 
  • trunk/openlayers/tests/Util.html

    r7538 r7943  
    170170    function test_Util_applyDefaults(t) { 
    171171     
    172         t.plan(11); 
     172        t.plan(12); 
    173173         
    174174        var to = {  
     
    205205        var ret = OpenLayers.Util.applyDefaults(to, from); 
    206206        t.eq(ret.rand, from.rand, "works with undefined to"); 
     207 
     208        //regression test for #1716 -- allow undefined from 
     209        try { 
     210            OpenLayers.Util.applyDefaults({}, undefined); 
     211            t.ok(true, "no exception thrown when from is undefined"); 
     212        } catch(err) { 
     213            t.fail("exception thrown when from is undefined:" + err); 
     214        } 
     215 
    207216    } 
    208217