aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/db.go b/db.go
index 6ec07a7..d15dc74 100644
--- a/db.go
+++ b/db.go
@@ -576,6 +576,18 @@ type Stats struct {
// you need the performance counters that occurred within that time span.
func (s *Stats) Sub(other *Stats) Stats {
var diff Stats
+ if s == nil {
+ if other == nil {
+ return diff
+ } else {
+ return *other
+ }
+ }
+ diff = *s
+ if other == nil {
+ return diff
+ }
+ diff.TxN = other.TxN - diff.TxN
diff.TxStats = s.TxStats.Sub(&other.TxStats)
return diff
}