diff --git a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js index e14b296c..7166b9a4 100644 --- a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js +++ b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js @@ -215,21 +215,23 @@ Ox.AnnotationPanel = function(options, self) { function renderEditMenu() { var annotation, annotationTitle, folder, isDefined, isEditable, isEvent, isEventOrPlace, isPlace, isString, - key, manageTitle, type, value + key, manageTitle, type, value; if (self.options.selected) { annotation = getAnnotation(self.options.selected); folder = getFolder(self.options.selected); - key = folder.options('id'); - type = folder.options('type'); - value = annotation.value; - isEditable = annotation.editable; - isEvent = type == 'event'; - isPlace = type == 'place'; - isEventOrPlace = isEvent || isPlace; - isString = type != 'text'; - // fixme: absence of annotation[type] may be an error - isDefined = isEventOrPlace && !!annotation[type] && !!annotation[type].type; - annotationTitle = folder.options('item') + ': "' + value + '"'; + if(annotation && folder) { + key = folder.options('id'); + type = folder.options('type'); + value = annotation.value; + isEditable = annotation.editable; + isEvent = type == 'event'; + isPlace = type == 'place'; + isEventOrPlace = isEvent || isPlace; + isString = type != 'text'; + // fixme: absence of annotation[type] may be an error + isDefined = isEventOrPlace && !!annotation[type] && !!annotation[type].type; + annotationTitle = folder.options('item') + ': "' + value + '"'; + } } manageTitle = (isDefined ? 'Edit' : 'Define') + ' ' + (isPlace ? 'Place' : isEvent ? 'Event' : 'Place or Event') + '...'