Fix possibly undefined var

Closes #15268
Merge pull request #15591 from cachedout/issue_15268

Fix possibly undefined var