prevent null exception

Signed-off-by: Peter <mcheung63@hotmail.com>