Change the 'if' condition to close correctly.

Signed-off-by: fatedier <512654112@qq.com>