Skip to content

Commit 1e142b0

Browse files
jilaypandyanashif
authored andcommitted
drivers: stepper: shell: fix null pointer check
This commit introduces null pointer check in print_callback Signed-off-by: Jilay Pandya <[email protected]>
1 parent 195c2c1 commit 1e142b0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/stepper/stepper_shell.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ static void print_callback(const struct device *dev, const enum stepper_event ev
4444
void *user_data)
4545
{
4646
const struct shell *sh = user_data;
47+
if (!sh) {
48+
return;
49+
}
4750

4851
switch (event) {
4952
case STEPPER_EVENT_STEPS_COMPLETED:

0 commit comments

Comments
 (0)