diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js index c2b57c2e4..308819a65 100644 --- a/loleaflet/src/control/Control.LokDialog.js +++ b/loleaflet/src/control/Control.LokDialog.js @@ -305,7 +305,10 @@ L.Control.LokDialog = L.Control.extend({ _paintDialogChild: function(dialogId, width, height, rectangle, imgData) { var strDlgId = this._toDlgPrefix(dialogId); var img = new Image(); - var canvas = document.getElementById(strDlgId + '-floating'); + var canvas = L.DomUtil.get(strDlgId + '-floating'); + if (!canvas) + return; // no floating window to paint to + canvas.width = width; canvas.height = height; var ctx = canvas.getContext('2d');