Ticket #2443 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

Map.updateSize does not correctly check for the existence of layers

Reported by: tmcw Owned by:
Priority: minor Milestone: 2.9 Release
Component: Map Version: 2.8
Keywords: Cc:
State:

Description

In cases where a map is initialized and resized before adding layers (I'm running into that corner case somehow), I've found that the loop that calls onMapResize() on each layer doesn't check to see whether the map actually has any layers, and so OpenLayers fails on a null reference. Patch attached which addresses this issue by adding a condition that this.layers != null, like is asked elsewhere in the code.

Attachments

layers_null_check.patch Download (0.7 KB) - added by tmcw 3 years ago.
Add check for this.layers being null

Change History

Changed 3 years ago by tmcw

Add check for this.layers being null

Changed 3 years ago by tschaub

  • state changed from Review to Awaiting User Feedback

A different manifestation of this problem was ticketed in #2461. Can you please confirm that you are still seeing this issue after r10022. If so, please provide a test case that fails without this patch. We are piling a lot of workarounds in Map.js. Having well commented tests will help us remember what they are all about.

Changed 3 years ago by tschaub

  • status changed from new to closed
  • state Awaiting User Feedback deleted
  • resolution set to fixed

This is further guarded against with r10044. Previously, the layers property of the map was initialized after calling map.updateSize. After r10044, this isn't the case.

Note: See TracTickets for help on using tickets.