@parse/push-adapter 4.1.2 → 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 +5 -1
- package/lib/GCM.js +4 -0
- package/package.json +1 -1
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);
|