From aa3440da323eb9d7ff07e6f4a690e7df125cba8f Mon Sep 17 00:00:00 2001 From: nikita Date: Fri, 7 Oct 2016 14:02:07 +0530 Subject: [PATCH] handled null checks. --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index ec91638..7b50a73 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -1470,14 +1470,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var imageCanvas = document.getElementById('imageCanvas' + bodyRegionId + '_MR'); - var width = imageCanvas.width; - var ht = imageCanvas.height; + if (imageCanvas != null || imageCanvas != undefined) { + var width = imageCanvas.width; + var ht = imageCanvas.height; + + var coloredCanvasContext = imageCanvas.getContext("2d"); + var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); + var coloredImageDataVar = coloredImageData; - var coloredCanvasContext = imageCanvas.getContext("2d"); - var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); - var coloredImageDataVar = coloredImageData; - $rootScope.coloredImageMRCanvasList[parseInt(bodyRegionId)] = coloredImageDataVar; + } @@ -1831,15 +1833,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var imageCanvas = document.getElementById('imageCanvas' + bodyRegionId); - var width = imageCanvas.width; - var ht = imageCanvas.height; + if (imageCanvas != null || imageCanvas != undefined) { + var width = imageCanvas.width; + var ht = imageCanvas.height; + + var coloredCanvasContext = imageCanvas.getContext("2d"); + var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); + var coloredImageDataVar = coloredImageData; - var coloredCanvasContext = imageCanvas.getContext("2d"); - var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); - var coloredImageDataVar = coloredImageData; - - $rootScope.coloredImageCanvasList[parseInt(bodyRegionId - 1)] = coloredImageDataVar; + $rootScope.coloredImageCanvasList[parseInt(bodyRegionId - 1)] = coloredImageDataVar; + } // if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) { @@ -4896,10 +4900,14 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.CalculateImageCordinates($rootScope.viewOrientationId); //3. - if ($scope.zoomInOut == 25) - $('#canvasDiv').scrollLeft(0) - else - $('#canvasDiv').scrollLeft($('#canvasDiv').width() / 2) + if ($scope.zoomInOut == 25) { + if ($('#canvasDiv') != null) + $('#canvasDiv').scrollLeft(0) + } + else { + if ($('#canvasDiv') != null) + $('#canvasDiv').scrollLeft($('#canvasDiv').width() / 2) + } //remove annotation speech bubble if ($('#dot').length > 0) { -- libgit2 0.21.4