Looks like a else clause is missing
Merge pull request #5669 from zhangcheng/follow_up_fix_#5643

Follow up fix to #5643