Skip to content

Commit ce5f05a

Browse files
committed
save
1 parent 7201a5b commit ce5f05a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

mdbx/cursor.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ func (c *Cursor) getVal(setkey, setval []byte, op uint) error {
228228
//
229229
// See mdb_cursor_put.
230230
func (c *Cursor) Put(key, val []byte, flags uint) error {
231+
if c._c == nil || c.txn == nil {
232+
return operrno("mdbx_cursor_put", C.MDBX_EINVAL)
233+
}
231234
var k, v *C.char
232235
if len(key) > 0 {
233236
k = (*C.char)(unsafe.Pointer(&key[0]))

mdbx/cursor_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1826,7 +1826,7 @@ func BenchmarkCursor_Set_Random(b *testing.B) {
18261826
}
18271827
}
18281828

1829-
func BenchmarkCursor_Put(b *testing.B) {
1829+
func BenchmarkCursor_Put_Sequence(b *testing.B) {
18301830
env, _ := setup(b)
18311831

18321832
const N = 100

0 commit comments

Comments
 (0)