fixes #2414 Simple fix to prevent null pointer exception.