0
0
Fork 0

fix bug, internal ops must check that index is open

possibly fixes https://github.com/couchbaselabs/cbft/issues/49
This commit is contained in:
Marty Schoch 2015-04-03 18:05:24 -04:00
parent 867110e03b
commit 11262c793f
1 changed files with 12 additions and 0 deletions

View File

@ -668,6 +668,10 @@ func (i *indexImpl) GetInternal(key []byte) (val []byte, err error) {
i.mutex.RLock()
defer i.mutex.RUnlock()
if !i.open {
return nil, ErrorIndexClosed
}
reader, err := i.i.Reader()
if err != nil {
return nil, err
@ -689,6 +693,10 @@ func (i *indexImpl) SetInternal(key, val []byte) error {
i.mutex.RLock()
defer i.mutex.RUnlock()
if !i.open {
return ErrorIndexClosed
}
return i.i.SetInternal(key, val)
}
@ -696,6 +704,10 @@ func (i *indexImpl) DeleteInternal(key []byte) error {
i.mutex.RLock()
defer i.mutex.RUnlock()
if !i.open {
return ErrorIndexClosed
}
return i.i.DeleteInternal(key)
}