place could be null

This commit is contained in:
j 2017-02-25 16:58:32 +01:00
parent 07d9b9c925
commit 6d59519c64

View file

@ -231,14 +231,15 @@ Ox.AnnotationFolder = function(options, self) {
// FIXME: duplicated! // FIXME: duplicated!
select: function(data) { select: function(data) {
if ( if (
!data.id && self.options.selected (!data || !data.id) && self.options.selected
&& isDefined(Ox.getObjectById(self.options.items, self.options.selected)) && isDefined(Ox.getObjectById(self.options.items, self.options.selected))
) { ) {
// only deselect annotation if the place deselect was not // only deselect annotation if the place deselect was not
// caused by switching to an annotation without place // caused by switching to an annotation without place
self.$annotations.options({selected: ''}); self.$annotations.options({selected: ''});
} else if ( } else if (
data.annotationIds data
&& data.annotationIds
&& data.annotationIds.indexOf(self.options.selected) == -1 && data.annotationIds.indexOf(self.options.selected) == -1
) { ) {
// only select a new annotation if the currently selected // only select a new annotation if the currently selected