News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

default_param can be null in network commands, but handlers assume not null

Started by janry, May 31, 2026, 11:19:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

janry

Can be fixed by adding guard in each handler (265.patch) or by ensuring default_param is not null before dispatching command handler (266.patch).

I'm not sure if I covered every place in 265.patch - but doesn't matter much, because potential deficiencies will be detected and fixed later.

prissi

I personally prefer 266. I think that then one needs also to make sure that in local execution the default_param is not zero since locally commands may use the queue too.

janry

Hmm, it seems that 266 is wrong, because some handlers rely on default_param being null. For the same reason we can't replace nulls with empty string in local commands. One example is tool_build_house_t.

We could convert handlers that anticipate null param to anticipate "" param instead. And then we can replace nulls with "" on dispatch. I will check if that is viable.

janry

A patch that
1) replaces null-triggered behavior in command handlers to be ""-triggered instead
2) guards against null param on command dispatch for both network and local paths

prissi

Upon closer looking at the code, the local NULL pointer check is not needed, as tools are sometimes called directly without queuing and still have to deal with an empty string.