Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-01-15 11:03:46 -0500
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-01-15 11:03:46 -0500
commitaf7774a272a2b7cc1e34e3082a473a5d71a83355 (patch)
tree958eda20aa858cdd6e40b6938b1fd9240bc3d300
parent5f3ad6dbf165bb7ac779339f5db21ad742bf4d98 (diff)
downloadliza-af7774a272a2b7cc1e34e3082a473a5d71a83355.tar.gz
liza-af7774a272a2b7cc1e34e3082a473a5d71a83355.tar.bz2
liza-af7774a272a2b7cc1e34e3082a473a5d71a83355.zip
dapi: Do not perform static additions in invalid response data
* src/dapi/StaticAdditionDataApi.js (request): Do not unshift data if `response' is not an array.
-rw-r--r--src/dapi/StaticAdditionDataApi.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/dapi/StaticAdditionDataApi.js b/src/dapi/StaticAdditionDataApi.js
index 192e4be..e39e3ac 100644
--- a/src/dapi/StaticAdditionDataApi.js
+++ b/src/dapi/StaticAdditionDataApi.js
@@ -1,7 +1,7 @@
/**
* Adds static data to API response
*
- * Copyright (C) 2016 R-T Specialty, LLC.
+ * Copyright (C) 2016, 2018 R-T Specialty, LLC.
*
* This file is part of the Liza Data Collection Framework
*
@@ -98,6 +98,13 @@ module.exports = Class( 'StaticAdditionDataApi' )
this._api.request( data, function( err, response )
{
+ // if the data are invalid, do nothing
+ if ( !Array.isArray( response ) )
+ {
+ callback.call( inst, err, response );
+ return;
+ }
+
// return the response with our data
callback.call( inst,
err,