Fix EZP-19077: ezjscore fatal error encoding object w/out a node

Fixes https://jira.ez.no/browse/EZP-19077.

Happens when an object is encoded through ezjscore while it doesn't have a node yet (interrupted publishing, etc).