Issue #24802:correctly handle null pLocationid