Avoid dereferencing NULL pointers.
This commit is contained in:
+3
-1
@@ -29,7 +29,9 @@ void initialize_stack(struct stack *stack) {
|
||||
}
|
||||
|
||||
void delete_stack(struct stack *stack) {
|
||||
delete_card(stack->card);
|
||||
if (stack) {
|
||||
delete_card(stack->card);
|
||||
}
|
||||
free(stack);
|
||||
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user