Oh, right, because of the next line… I have just opened an issue in the engine:
https://github.com/christopho/solarus/issues/225
In the meantime, your fix is okay. Nice one.