Prevent crash when the annotation doesn't have the rectangle data
Change-Id: I04bc18f976bd7b2541418dda38b4c7809754dd4f Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97411 Tested-by: Jenkins Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
parent
8b133a76d3
commit
9db14f70a2
1 changed files with 11 additions and 9 deletions
|
@ -465,15 +465,17 @@ L.Annotation = L.Layer.extend({
|
|||
});
|
||||
this._map.addLayer(this._annotationMarker);
|
||||
}
|
||||
var stringTwips = this._data.rectangle.match(/\d+/g);
|
||||
var topLeftTwips = new L.Point(parseInt(stringTwips[0]), parseInt(stringTwips[1]));
|
||||
var offset = new L.Point(parseInt(stringTwips[2]), parseInt(stringTwips[3]));
|
||||
var bottomRightTwips = topLeftTwips.add(offset);
|
||||
var bounds = new L.LatLngBounds(
|
||||
this._map._docLayer._twipsToLatLng(topLeftTwips, this._map.getZoom()),
|
||||
this._map._docLayer._twipsToLatLng(bottomRightTwips, this._map.getZoom()));
|
||||
this._annotationMarker.setLatLng(bounds.getSouthWest());
|
||||
this._annotationMarker.on('dragstart drag dragend', this._onMarkerDrag, this);
|
||||
if (this._data.rectangle != null) {
|
||||
var stringTwips = this._data.rectangle.match(/\d+/g);
|
||||
var topLeftTwips = new L.Point(parseInt(stringTwips[0]), parseInt(stringTwips[1]));
|
||||
var offset = new L.Point(parseInt(stringTwips[2]), parseInt(stringTwips[3]));
|
||||
var bottomRightTwips = topLeftTwips.add(offset);
|
||||
var bounds = new L.LatLngBounds(
|
||||
this._map._docLayer._twipsToLatLng(topLeftTwips, this._map.getZoom()),
|
||||
this._map._docLayer._twipsToLatLng(bottomRightTwips, this._map.getZoom()));
|
||||
this._annotationMarker.setLatLng(bounds.getSouthWest());
|
||||
this._annotationMarker.on('dragstart drag dragend', this._onMarkerDrag, this);
|
||||
}
|
||||
},
|
||||
_onMarkerDrag: function(event) {
|
||||
if (this._annotationMarker == null)
|
||||
|
|
Loading…
Reference in a new issue