Fix EZP-21565: Workflow: restore object will cause fatal error

https://jira.ez.no/browse/EZP-21565

The issue was similar to [EZP-20558](https://jira.ez.no/browse/EZP-20558), which was a regression from [EZP-19660](https://jira.ez.no/browse/EZP-19660).

Manual testing.