This adds some more null checks to avoid a relational comparison with a null pointer, similar to 78198b6021a9695054dab039340202170b88423c. libstdc++-v3/ChangeLog: PR libstdc++/97415 * include/std/sstream (basic_stringbuf::_M_update_egptr) (basic_stringbuf::__xfer_bufptrs::__xfer_bufptrs): Check for null before comparing pointers. Tested powerpc64le-linux. Committed to trunk.