Skip to content

Commit

Permalink
Fix cppcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbi committed Jan 18, 2025
1 parent 79c6ee8 commit c7420cf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/squirrel/supertux_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static SQInteger wait(HSQUIRRELVM vm, float seconds, bool forced = false)
{
ssq::VM* ssq_vm = ssq::VM::get(vm);
assert(ssq_vm);
if (!ssq_vm->isThread()) return 0;
if (ssq_vm && !ssq_vm->isThread()) return 0;

if (!forced)
{
Expand Down

2 comments on commit c7420cf

@Brockengespenst
Copy link
Contributor

@Brockengespenst Brockengespenst commented on c7420cf Jan 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a quite important one. It seems this fixes a crash in 'PIcnic With Penny' when pressing Esc in the intro sequence. But the assert will still complain about ssqm_vm being nullptr and I get a crash anyway (at least when I use the Debug configuration on my system). Do you think that it makes sense to remove the assert completely?

@tobbi
Copy link
Member Author

@tobbi tobbi commented on c7420cf Jan 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a quite important one. It seems this fixes a crash in 'PIcnic With Penny' when pressing Esc in the intro sequence. But the assert will still complain about ssqm_vm being nullptr and I get a crash anyway (at least when I use the Debug configuration on my system). Do you think that I makes sense to remove the assert completely?

To be honest, I realized later on when Narre closed a related issue that this is more than just a simple code style change (I thought the assert would take care of that for all configurations, turns out I was mistaken).

@Vankata453 You were the one who added that. Can you give an insight?

Please sign in to comment.