@parse/push-adapter 4.1.1 → 4.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/APNS.js CHANGED
@@ -120,7 +120,11 @@ var APNS = exports.APNS = function () {
120
120
  _createClass(APNS, [{
121
121
  key: 'send',
122
122
  value: function send(data, allDevices) {
123
- var coreData = data.data;
123
+ var coreData = data && data.data;
124
+ if (!coreData || !allDevices || !Array.isArray(allDevices)) {
125
+ _npmlog2.default.warn(LOG_PREFIX, 'invalid push payload');
126
+ return;
127
+ }
124
128
  var expirationTime = data['expiration_time'] || coreData['expiration_time'];
125
129
  var collapseId = data['collapse_id'] || coreData['collapse_id'];
126
130
  var pushType = data['push_type'] || coreData['push_type'];
package/lib/GCM.js CHANGED
@@ -46,6 +46,10 @@ GCM.GCMRegistrationTokensMax = GCMRegistrationTokensMax;
46
46
  GCM.prototype.send = function (data, devices) {
47
47
  var _this = this;
48
48
 
49
+ if (!data || !devices || !Array.isArray(devices)) {
50
+ _npmlog2.default.warn(LOG_PREFIX, 'invalid push payload');
51
+ return;
52
+ }
49
53
  var pushId = (0, _PushAdapterUtils.randomString)(10);
50
54
  // Make a new array
51
55
  devices = devices.slice(0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parse/push-adapter",
3
- "version": "4.1.1",
3
+ "version": "4.1.3",
4
4
  "description": "Base parse-server-push-adapter",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -40,7 +40,7 @@
40
40
  "semantic-release": "17.4.6"
41
41
  },
42
42
  "dependencies": {
43
- "@parse/node-apn": "5.1.0",
43
+ "@parse/node-apn": "5.1.3",
44
44
  "@parse/node-gcm": "1.0.2",
45
45
  "npmlog": "4.1.2",
46
46
  "parse": "3.4.0"