avoid InvalidOperation and NullReferenceException

fixes #5522
Merge pull request #5523 from Mailaender/dead-repair-indicator

avoid InvalidOperation and NullReferenceException