From ba82dc8a57ed395cab480e81ef21f8d26e000a7c Mon Sep 17 00:00:00 2001 From: Peter Richmond Date: Tue, 31 Jul 2018 13:03:59 -0700 Subject: [PATCH] Change Facade.library() logic As currently written, Facade.library() will crash when called from Facade.device() if options.library is an object without a name property. This is because we will pass over both of the if statements in Facade.library() and attempt to run .indexOf() inside of Facade.device() on either an object literal or undefined. This adds validation to ensure that library.name exists and is a string. --- lib/facade.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/facade.js b/lib/facade.js index 4c4c781..f2ef3cc 100644 --- a/lib/facade.js +++ b/lib/facade.js @@ -365,6 +365,7 @@ Facade.prototype.library = function() { var library = this.proxy('options.library'); if (!library) return { name: 'unknown', version: null }; if (typeof library === 'string') return { name: library, version: null }; + if (typeof library.name !== 'string') library.name = 'unknown'; return library; };