diff options
author | Matt Joiner <anacrolix@gmail.com> | 2019-10-25 11:50:54 +1100 |
---|---|---|
committer | Matt Joiner <anacrolix@gmail.com> | 2019-10-29 18:17:43 +1100 |
commit | 5bbbe8ffc987cf4a6d66aab8c5b371892e5ffbcf (patch) | |
tree | c77606714b8058a1dd41fca99469f902ecc7da56 /tx.go | |
parent | Improve comment on Tx.verify (diff) | |
download | stm-5bbbe8ffc987cf4a6d66aab8c5b371892e5ffbcf.tar.gz stm-5bbbe8ffc987cf4a6d66aab8c5b371892e5ffbcf.tar.xz |
Panic when trying to set a nil Var
This wasn't caught, and would cause errors later that weren't easy to trace.
(cherry picked from commit 7b273432145605d367557e60ab51b9eb7dbbffeb)
Diffstat (limited to 'tx.go')
-rw-r--r-- | tx.go | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -55,6 +55,9 @@ func (tx *Tx) Get(v *Var) interface{} { // Set sets the value of a Var for the lifetime of the transaction. func (tx *Tx) Set(v *Var, val interface{}) { + if v == nil { + panic("nil Var") + } tx.writes[v] = val } |