-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quick fix to a Seg Fault issue #10
Conversation
Codecov Report
@@ Coverage Diff @@
## main #10 +/- ##
=======================================
Coverage 44.10% 44.10%
=======================================
Files 6 6
Lines 331 331
=======================================
Hits 146 146
Misses 155 155
Partials 30 30 Continue to review full report at Codecov.
|
engines/leveldb/leveldb.go
Outdated
@@ -115,6 +119,10 @@ func (db *LevelDBEngine) Put(key, value []byte, options *opts.Options) (err erro | |||
|
|||
// Thread-unsafe put that is called both by the Transaction and the Store. | |||
func (db *LevelDBEngine) put(key, value []byte, options *opts.Options) (err error) { | |||
// Create a default to prevent SigFaults when accessing options{} | |||
if options == nil { | |||
options = &opts.Options{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch, mind if we use opts.New() to make sure that we have the default options, e.g. the namespace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @DanielSollis for the great catch and quick fix!
I was running into Seg-Faults while implementing tests for Benjamin's PR and found this bug.