bugfix: Cannot set property 'id' of null

Sometimes snapshot === null, but condition don't take this into account