Commit 4d3356435f

Shawn Landden <shawn@git.icu>
2019-06-16 20:17:33
stage1: check for null in buf_len and buf_ptr
follow up for f4b8850002d5
1 parent f4b8850
Changed files (1)
src/buffer.hpp
@@ -27,11 +27,13 @@ Buf *buf_sprintf(const char *format, ...)
 Buf *buf_vprintf(const char *format, va_list ap);
 
 static inline size_t buf_len(Buf *buf) {
+    assert(buf);
     assert(buf->list.length);
     return buf->list.length - 1;
 }
 
 static inline char *buf_ptr(Buf *buf) {
+    assert(buf);
     assert(buf->list.length);
     return buf->list.items;
 }