Skip to content

Commit

Permalink
Avoid unhandled exception
Browse files Browse the repository at this point in the history
Change-Id: I2a168a79f334ca5048a85f98350aaa5c08bd1ad8
  • Loading branch information
Tor Lillqvist committed Jun 11, 2019
1 parent d1087ae commit 07b6d7e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions loleaflet/src/layer/AnnotationManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,14 @@ L.AnnotationManager = L.Class.extend({
};
}

// What if this._initialLayoutData is still undefined when we get here? (I.e. if
// contentWrapperClass.length == 0.) No idea. Using
// this._initialLayoutData.menuWidth below will lead to an unhandled exception.
// Maybe best to just return then? Somebody who understands the code could fix this
// better, perhaps.
if (this._initialLayoutData === undefined)
return;

var menuClass = $('.loleaflet-annotation-menu');
if ((this._initialLayoutData.menuWidth === undefined) && menuClass.length > 0) {
this._initialLayoutData.menuWidth = parseInt(menuClass.css('width'));
Expand Down

0 comments on commit 07b6d7e

Please sign in to comment.