From 108a6856b75e8bb7f04669b5d405640a79d70afa Mon Sep 17 00:00:00 2001 From: Michael-Rainabba Richardson Date: Fri, 31 Mar 2017 13:30:32 -0700 Subject: [PATCH] Hardening against null/undefined If the files object is set to null/undefined, the call to .map throws an unhanded exception, but it shouldn't be called anyway if files isn't a valid array. This patch accounts for that possibility. --- dist/lf-ng-md-file-input.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/lf-ng-md-file-input.js b/dist/lf-ng-md-file-input.js index 0597d22..c855f8d 100644 --- a/dist/lf-ng-md-file-input.js +++ b/dist/lf-ng-md-file-input.js @@ -598,7 +598,7 @@ }); var onFileChanged = function(files) { - if(files.length <= 0){ + if(files.length <= 0 || !scope.lfFiles || !scope.lfFiles.map){ //Check for scope.lfFiles.map needed because if file is set to NULL, map doesn't exist return; } var names = scope.lfFiles.map(function(obj){