瀏覽代碼

make sure not to overwrite values

Raanan Weber 7 年之前
父節點
當前提交
7ef4b25df0
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      Viewer/src/configuration/configurationCompatibility.ts

+ 2 - 1
Viewer/src/configuration/configurationCompatibility.ts

@@ -33,7 +33,7 @@ export function processConfigurationCompatibility(configuration: ViewerConfigura
     }
 }
 
-function setKeyInObject(object: any, keys: string, value: any) {
+function setKeyInObject(object: any, keys: string, value: any, shouldOverwrite?: boolean) {
     let keySplit = keys.split(".");
     if (keySplit.length === 0) return;
     let lastKey = keySplit.pop();
@@ -43,5 +43,6 @@ function setKeyInObject(object: any, keys: string, value: any) {
         curObj[key] = curObj[key] || {};
         curObj = curObj[key];
     });
+    if (curObj[lastKey] !== undefined && !shouldOverwrite) return;
     curObj[lastKey] = value;
 }