Fix issue #2219

Signed-off-by: Yue Lin Ho <b8732003@student.nsysu.edu.tw>
You could also move the variable declaration into the if clause this way there is no need to add parentheses.