LPS-3417 Fix a potential nullpointer