From 2f0c191ae566d1f3a753f04d982ecf9919972b00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20R=C3=B6wenstrunk?= <roewenstrunk@uni-paderborn.de>
Date: Fri, 24 Jan 2025 09:49:46 +0100
Subject: [PATCH] Error fixed while loading annotations without an active page
 in TextFacsimileSplitView

fixes #529
---
 app/controller/window/text/TextFacsimileSplitView.js | 2 +-
 app/view/window/text/TextFacsimileSplitView.js       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/controller/window/text/TextFacsimileSplitView.js b/app/controller/window/text/TextFacsimileSplitView.js
index e05b08aae..0abb40b41 100644
--- a/app/controller/window/text/TextFacsimileSplitView.js
+++ b/app/controller/window/text/TextFacsimileSplitView.js
@@ -145,7 +145,7 @@ Ext.define('EdiromOnline.controller.window.text.TextFacsimileSplitView', {
     onAnnotationsVisibilityChange: function(view, visible) {
         var me = this;
 
-        if(visible)
+        if(visible && view.getActivePage() !== null)
             window.doAJAXRequest('data/xql/getAnnotationsInText.xql',
                 'GET', 
                 {
diff --git a/app/view/window/text/TextFacsimileSplitView.js b/app/view/window/text/TextFacsimileSplitView.js
index dd6497d47..282a624db 100644
--- a/app/view/window/text/TextFacsimileSplitView.js
+++ b/app/view/window/text/TextFacsimileSplitView.js
@@ -411,7 +411,7 @@ Ext.define('EdiromOnline.view.window.text.TextFacsimileSplitView', {
     
     getActivePage: function() {
         var me = this;
-        return me.activePage.get('id');
+        return (typeof me.activePage !== 'undefined' && me.activePage !== null?me.activePage.get('id'):null);
     },
 
 	setChapters: function (chapters) {
-- 
GitLab