diff --git a/lib/modules/device.js b/lib/modules/device.js index 238149c..b0fe712 100644 --- a/lib/modules/device.js +++ b/lib/modules/device.js @@ -469,6 +469,7 @@ OnvifDevice.prototype._mediaGetProfiles = function() { reject(new Error('Failed to initialize the device: The targeted device does not any media profiles.')); return; } + profiles = [].concat(profiles) // in case profiles is not a list, then forEach below will report an error profiles.forEach((p) => { let profile = { 'token': p['$']['token'], @@ -646,4 +647,4 @@ OnvifDevice.prototype._mediaGetSnapshotUri = function() { return promise; }; -module.exports = OnvifDevice; \ No newline at end of file +module.exports = OnvifDevice;