I mean add 
if (Memory::IsValidAddress(initAddr))
before 
Memory::Write_U32(ctx->avc.avcDecodeResult ? 1 : 0, initAddr);