diff --git a/d2-tracker/dhis2.angular.services.js b/d2-tracker/dhis2.angular.services.js index ab0570777..0a3a209f8 100644 --- a/d2-tracker/dhis2.angular.services.js +++ b/d2-tracker/dhis2.angular.services.js @@ -451,12 +451,12 @@ var d2Services = angular.module('d2Services', ['ngResource']) const keyString = String(key); // is key a name? - const option = options.find(option => keyString === option.displayName); + const option = options.find(option => option && keyString === option.displayName); if (option) { return option.code; } // is key a code? - if (options.find(option => keyString === option.code)) { + if (options.find(option => option && keyString === option.code)) { return key; } // not a part of the option set @@ -471,12 +471,12 @@ var d2Services = angular.module('d2Services', ['ngResource']) const keyString = String(key); // is key a code? - const option = options.find(option => keyString === option.code); + const option = options.find(option => option && keyString === option.code); if (option) { return option.displayName; } // is key a name? - if (options.find(option => keyString === option.displayName)) { + if (options.find(option => option && keyString === option.displayName)) { return key; } // not a part of the option set