aboutsummaryrefslogtreecommitdiff
path: root/tx.go
diff options
context:
space:
mode:
authorMatt Joiner <anacrolix@gmail.com>2019-10-25 11:50:54 +1100
committerMatt Joiner <anacrolix@gmail.com>2019-10-29 18:17:43 +1100
commit5bbbe8ffc987cf4a6d66aab8c5b371892e5ffbcf (patch)
treec77606714b8058a1dd41fca99469f902ecc7da56 /tx.go
parentImprove comment on Tx.verify (diff)
downloadstm-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.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/tx.go b/tx.go
index 127480e..c2dcbdc 100644
--- a/tx.go
+++ b/tx.go
@@ -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
}