diff --git a/sqlite-vec.c b/sqlite-vec.c index d8490cd..3cc802f 100644 --- a/sqlite-vec.c +++ b/sqlite-vec.c @@ -2483,7 +2483,9 @@ static int vec_eachOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor) { static int vec_eachClose(sqlite3_vtab_cursor *cur) { vec_each_cursor *pCur = (vec_each_cursor *)cur; - pCur->cleanup(pCur->vector); + if(pCur->vector) { + pCur->cleanup(pCur->vector); + } sqlite3_free(pCur); return SQLITE_OK; } diff --git a/tests/test-loadable.py b/tests/test-loadable.py index b14902a..a8058c9 100644 --- a/tests/test-loadable.py +++ b/tests/test-loadable.py @@ -1614,6 +1614,9 @@ def test_vec_each(): {"rowid": 2, "value": 3.0}, ] + with _raises("Input must have type BLOB (compact format) or TEXT (JSON), found NULL"): + vec_each_f32(None) + import io