When editing an existing module, the fields are set back to Null.
When using filters and the module is new the fields are filled by the filters settings but, once the module is saved once, go back to null.
Just wondering if a boolean check wouldn't be enough. So instead of if ($data->id == null) use if (!$data->id). It would also catch cases where the ID would be 0 or false, which is less strict than == null but serves the same purpose.
edit: It's actually doing exactly the same thing, due to the "loose" compare function (==). It will return true also for 0, false or an empty string. So there is no point in checking if it equals null, just use the boolean check (or !empty() if you prefer that).
@test ok
While posting discovered you beat me to it.
Tested creating and modifying a module both in empty and filtered list. All tests passed.
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7058.