Fix cases where setting NULL was being incorrectly completely ignored

* Fixes a fairly serious regression where any capture relying on setting
  NULL as one of several state objects would instead just get the previous
  state left over.
* This was a bug introduced with 7aee40f7a4cc8aa07820c427c9a22a36d6fac186
  where we checked for whether resources were present in the replay - but
  it didn't account for ResourceIds being 0 in some cases - which is valid
  and corresponds ot setting NULL, but returns false from HasLiveResource.