feat: block partition support
[lunaix-os.git] / lunaix-os / includes / lunaix / buffer.h
index 605cf8b47602e62fdcbe35bf1d864be022e7a15c..851d56844f3fd6854904c5e36da197f0818c453b 100644 (file)
@@ -40,6 +40,10 @@ vbuf_alloc(struct vecbuf* vec, void* buf, size_t len);
 static inline size_t
 vbuf_size(struct vecbuf* vbuf)
 {
+    if (!vbuf) {
+        return 0;
+    }
+
     struct vecbuf* last =
       list_entry(vbuf->components.prev, struct vecbuf, components);
     return last->acc_sz;