nrf52_bsim: Fix possible NULL pointer dereference
Fixed a very unlikely NULL pointer dereference, which could occur in an error condition, triggered if the test/fake HW timer model was enabled but there was no registered handler for that timer tick. The de-reference was in the error message printout. Fixes #10778 Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
This commit is contained in:
parent
c6799dc7a1
commit
b3ea738a84
1 changed files with 6 additions and 2 deletions
|
@ -167,9 +167,13 @@ void bst_post_init(void)
|
|||
void bst_tick(bs_time_t time)
|
||||
{
|
||||
|
||||
if (current_test && current_test->test_tick_f) {
|
||||
if (current_test == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (current_test->test_tick_f) {
|
||||
current_test->test_tick_f(time);
|
||||
} else {
|
||||
} else if (current_test->test_id) {
|
||||
bs_trace_error_line("the test id %s doesn't have a tick handler"
|
||||
" (how come did we arrive here?)\n",
|
||||
current_test->test_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue