Check if variable isset to avoid undefined error
Merge pull request #3198 from toddlahman/master

Fix for Issue #3197