From 7b273432145605d367557e60ab51b9eb7dbbffeb Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Fri, 25 Oct 2019 11:50:54 +1100 Subject: Panic when trying to set a nil Var This wasn't caught, and would cause errors later that weren't easy to trace. --- tx.go | 3 +++ 1 file changed, 3 insertions(+) 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 } -- cgit v1.2.3