check for null value to fix static analyzer warning