This fixes undefined behavior resulting from adding offsets to nullptr. (cherry picked from commit a220e7c422)
a220e7c422