From 0f7ce2bf2e8ec7b5239362aaa0e54d8758d2c916 Mon Sep 17 00:00:00 2001
From: "j.goderbauer" <j.goderbauer@adito.de>
Date: Tue, 28 Jan 2020 15:09:53 +0100
Subject: [PATCH] Loghistory lead to error when a value was null

---
 process/Loghistory_lib/process.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/process/Loghistory_lib/process.js b/process/Loghistory_lib/process.js
index 57832021be..15f076f82f 100644
--- a/process/Loghistory_lib/process.js
+++ b/process/Loghistory_lib/process.js
@@ -186,17 +186,17 @@ LogHistoryExecutor.prototype.execute = function ()
                 {
                     //TODO: CLOB-check should be done by viewing the structure column type
                     //use .trim() for "[CLOB]" check because in some case the value "[CLOB]\n" my be given
-                    if (this.oldValues[i].trim() == "[CLOB]" || this.oldValues[i] == "")
+                    if (this.oldValues[i] != null && (this.oldValues[i].trim() == "[CLOB]" || this.oldValues[i].trim() == ""))
                         description.push(translate.withArguments("%0 \"%1\"", [logfieldTitle + ":", this.newValues[i]], this.translationLanguage));
                     else
                         description.push(translate.withArguments("%0 from \"%1\" to \"%2\"", [logfieldTitle + ":", this.oldValues[i], this.newValues[i]], this.translationLanguage));
                         
                 }
                 //use .trim() for "[CLOB]" check because in some case the value "[CLOB]\n" my be given
-                if (this.sqlAction == 'I' && this.newValues[i] != "" && this.newValues[i].trim() != "[CLOB]")
+                if (this.sqlAction == 'I' && this.newValues[i] != "" && this.newValues[i] != null && this.newValues[i].trim() != "[CLOB]")
                     description.push(logfieldTitle + ": \"" + this.newValues[i] + "\"");
                 //use .trim() for "[CLOB]" check because in some case the value "[CLOB]\n" my be given
-                if (this.sqlAction == 'D' && this.oldValues[i] != "" && this.oldValues[i].trim() != "[CLOB]")
+                if (this.sqlAction == 'D' && this.oldValues[i] != "" && this.oldValues[i] != null  && this.oldValues[i].trim() != "[CLOB]")
                     description.push(logfieldTitle + ": \"" + this.oldValues[i] + "\"");
             }
         }
-- 
GitLab