fix bug that p_left and p_right may be NULL

Signed-off-by: feixiaoxing <feixiaoxing@163.com>