Skip to content

Commit

Permalink
replace NULL returns with throws for scan-build
Browse files Browse the repository at this point in the history
  • Loading branch information
mkv-vcm committed Dec 3, 2021
1 parent c089bce commit 37595e9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/signTx.c
Expand Up @@ -2266,7 +2266,7 @@ ins_sign_tx_aux_data_context_t* accessAuxDataContext()
#ifndef DEVEL
ASSERT(false);
#endif
return NULL;
THROW(ERR_ASSERT);
}
}

Expand Down Expand Up @@ -2295,7 +2295,7 @@ ins_sign_tx_body_context_t* accessBodyContext()
#ifndef DEVEL
ASSERT(false);
#endif
return NULL;
THROW(ERR_ASSERT);
}
}

Expand All @@ -2310,6 +2310,6 @@ ins_sign_tx_witness_context_t* accessWitnessContext()
#ifndef DEVEL
ASSERT(false);
#endif
return NULL;
THROW(ERR_ASSERT);
}
}
6 changes: 0 additions & 6 deletions src/signTx.h
Expand Up @@ -213,15 +213,9 @@ ins_sign_tx_body_context_t* accessBodyContext();
ins_sign_tx_witness_context_t* accessWitnessContext();


#ifdef DEVEL
#define AUX_DATA_CTX (ASSERT(accessAuxDataContext() != NULL), accessAuxDataContext())
#define BODY_CTX (ASSERT(accessBodyContext() != NULL), accessBodyContext())
#define WITNESS_CTX (ASSERT(accessWitnessContext() != NULL), accessWitnessContext())
#else
#define AUX_DATA_CTX (accessAuxDataContext())
#define BODY_CTX (accessBodyContext())
#define WITNESS_CTX (accessWitnessContext())
#endif

handler_fn_t signTx_handleAPDU;

Expand Down
2 changes: 1 addition & 1 deletion src/signTxPoolRegistration.c
Expand Up @@ -787,7 +787,7 @@ static void signTxPoolRegistration_handleOwnerAPDU(uint8_t* wireDataBuffer, size
PRINTF("\n");

subctx->numOwnersGivenByPath++;
ASSERT(!ctx->poolOwnerByPath);
VALIDATE(!ctx->poolOwnerByPath, ERR_INVALID_DATA);
ctx->poolOwnerByPath = true;
memmove(&ctx->poolOwnerPath, &owner->path, SIZEOF(owner->path));
break;
Expand Down

0 comments on commit 37595e9

Please sign in to comment.