Prevent NPE if pushes/gets occur after the db is already closed #6
No reviewers
Labels
No Label
bug
duplicate
enhancement
feature
help wanted
invalid
question
wontfix
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: lunny/levelqueue#6
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "zeripath/levelqueue:prevent-npe-when-closed"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Due to the nil-ing out of the
.db
fields whenClose
is called anyfurther calls to the queue/set functions will result in an NPE.
This PR protects against this.
Signed-off-by: Andrew Thornton art27@cantab.net
@ -301,3 +321,3 @@
defer queue.highLock.Unlock()
if !queue.closeUnderlyingDB {
if !queue.closeUnderlyingDB || queue.db == nil {
Is this really necessary?
IMO it's necessary. closeUnderlyingDB can be true or false. But the code below shouldn't access nil db.
@ -184,3 +184,3 @@
queue.set.lock.Lock()
defer queue.set.lock.Unlock()
if !queue.closeUnderlyingDB {
if !queue.closeUnderlyingDB || queue.db == nil {
As above.