ReplaceTables: Fix null checks
Merge pull request #7165 from lioncash/safe

ReplaceTables: Fix null checks