Fix for a potential NPE

Signed-off-by: Gorkem Ercan <gorkem.ercan@gmail.com>