[libc++][NFC] Add assertions before calling memmove
Since we're checking preconditions for calling memmove, we might
as well do that properly.
Differential Revision: https://reviews.llvm.org/D138798
NOKEYCHECK=True
GitOrigin-RevId: b95379d20e0493d4ca073fbaa2f878344568425b
diff --git a/include/fstream b/include/fstream
index 65b22a4..62c6f53 100644
--- a/include/fstream
+++ b/include/fstream
@@ -754,7 +754,8 @@
else
{
if (__extbufend_ != __extbufnext_) {
- _LIBCPP_ASSERT(__extbufnext_ != nullptr, "underflow moving from NULL" );
+ _LIBCPP_ASSERT(__extbufnext_ != nullptr, "underflow moving from nullptr");
+ _LIBCPP_ASSERT(__extbuf_ != nullptr, "underflow moving into nullptr");
_VSTD::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
}
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);