Skip to content
This repository was archived by the owner on May 14, 2021. It is now read-only.

Commit c356cba

Browse files
authored
Merge pull request #46 from kinecosystem/hotfix/accountmanager_npe
crash fix - add null check inside removeAccountCreationRegistration
2 parents 25cd935 + ea72d61 commit c356cba

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

kin-devplatform-sdk/src/main/java/kin/devplatform/accountmanager/AccountManagerImpl.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,7 @@ private void handlePendingCreationState() {
176176
Logger.log(new Log().withTag(TAG).put("setAccountState", "PENDING_CREATION"));
177177
// Start listen for account creation on the blockchain side.
178178
final Handler handler = new Handler(Looper.getMainLooper());
179-
if (accountCreationRegistration != null) {
180-
removeAccountCreationRegistration();
181-
}
179+
removeAccountCreationRegistration();
182180

183181
prepareAccountCreationTimeoutFallback(handler);
184182
accountCreationRegistration = getKinAccount().blockchainEvents()
@@ -261,8 +259,10 @@ private KinAccount getKinAccount() {
261259
}
262260

263261
private void removeAccountCreationRegistration() {
264-
accountCreationRegistration.remove();
265-
accountCreationRegistration = null;
262+
if (accountCreationRegistration != null) {
263+
accountCreationRegistration.remove();
264+
accountCreationRegistration = null;
265+
}
266266
}
267267

268268
private boolean isValidState(int currentState, int newState) {

0 commit comments

Comments
 (0)