Skip to content

Commit e3b8b40

Browse files
committed
Adds precondition for checking if user is not merging on itself
1 parent 0d567d5 commit e3b8b40

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Parse/Parse/Internal/PFAssert.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ return rval;\
7575
#define PFBailTaskIfError(condition, error) \
7676
PFBailIfError(condition, error, [BFTask taskWithError:error])
7777

78+
#define PFPrecondition(condition, description, ...) \
79+
if (!(condition)) { \
80+
return [PFErrorUtilities errorWithCode:-1 message:[NSString stringWithFormat:description, ##__VA_ARGS__]];\
81+
}
82+
7883
/**
7984
Raises an `NSInternalInconsistencyException`. Use `description` to supply the way to fix the exception.
8085
*/

Parse/Parse/PFUser.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ - (BFTask *)signUpAsync:(BFTask *)toAwait {
509509
// self doesn't have any outstanding saves, so we can safely merge its operations
510510
// into the current user.
511511

512-
PFConsistencyAssert(!self._current, @"Attempt to merge currentUser with itself.");
512+
PFPrecondition(!self._current, @"Attempt to merge currentUser with itself.");
513513

514514
@synchronized ([currentUser lock]) {
515515
NSString *oldUsername = [currentUser.username copy];

0 commit comments

Comments
 (0)