From 7f8e052a2631477f3efe2b740be3092fa3accace Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Sat, 3 Oct 2015 18:31:53 +0100 Subject: [PATCH] Handle newly saved files to avoid NaN --- lib/file-control-xhr.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/file-control-xhr.php b/lib/file-control-xhr.php index ce16214..2cfe95e 100644 --- a/lib/file-control-xhr.php +++ b/lib/file-control-xhr.php @@ -212,7 +212,7 @@ if (!$error && $_GET['action']=="save") { $doNext .= 'top.ICEcoder.message("Sorry, could not write '.$ftpFilepath.' at '.$ftpHost.'");'; } $doNext .= 'top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1]="'.$filemtime.'";'; - $doNext .= 'top.ICEcoder.openFileVersions[top.ICEcoder.selectedTab-1]+=1;top.ICEcoder.updateVersionsDisplay();'; + $doNext .= '(function() {var x=top.ICEcoder.openFileVersions; var y=top.ICEcoder.selectedTab-1; x[y] = "undefined" != typeof x[y] ? x[y]+1 : 1})();top.ICEcoder.updateVersionsDisplay();'; // Local saving } else { // Newly created files have the perms set too @@ -246,7 +246,7 @@ if (!$error && $_GET['action']=="save") { clearstatcache(); $filemtime = $serverType=="Linux" ? filemtime($file) : "1000000"; $doNext .= 'top.ICEcoder.openFileMDTs[top.ICEcoder.selectedTab-1]="'.$filemtime.'";'; - $doNext .= 'top.ICEcoder.openFileVersions[top.ICEcoder.selectedTab-1]+=1;top.ICEcoder.updateVersionsDisplay();'; + $doNext .= '(function() {var x=top.ICEcoder.openFileVersions; var y=top.ICEcoder.selectedTab-1; x[y] = "undefined" != typeof x[y] ? x[y]+1 : 1})();top.ICEcoder.updateVersionsDisplay();'; } // Save a version controlled backup source of the file