Skip to content

Commit 40e83e2

Browse files
committed
fix: handled crash for empty userCompletedAction
1 parent bb60a24 commit 40e83e2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

www.es6/branch.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,11 @@ Branch.prototype.logout = function() {
224224
* @return (Promise)
225225
*/
226226
Branch.prototype.userCompletedAction = function(action, metaData) {
227+
if (!action) {
228+
return new Promise(function(resolve, reject) {
229+
reject('Please set an event name');
230+
});
231+
}
227232

228233
var args = [ action ];
229234

www/branch.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ Branch.prototype.logout = function () {
208208
* @return (Promise)
209209
*/
210210
Branch.prototype.userCompletedAction = function (action, metaData) {
211+
if (!action) {
212+
return new Promise(function (resolve, reject) {
213+
reject('Please set an event name');
214+
});
215+
}
211216

212217
var args = [action];
213218

0 commit comments

Comments
 (0)