aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Joiner <anacrolix@gmail.com>2019-10-25 11:50:54 +1100
committerMatt Joiner <anacrolix@gmail.com>2019-10-25 11:50:54 +1100
commit7b273432145605d367557e60ab51b9eb7dbbffeb (patch)
treed977c4edcb95c96c22be33c42dd6d5dd47f7bb12
parentGet rid of globalCond (diff)
downloadstm-7b273432145605d367557e60ab51b9eb7dbbffeb.tar.gz
stm-7b273432145605d367557e60ab51b9eb7dbbffeb.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.
-rw-r--r--tx.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/tx.go b/tx.go
index 45f8006..d4f343a 100644
--- a/tx.go
+++ b/tx.go
@@ -69,6 +69,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
}