From 808cf9dfc0b74e3edeadeebeaa2d4ad084b2e32a Mon Sep 17 00:00:00 2001 From: Jeromy Date: Thu, 9 Oct 2014 23:21:40 -0700 Subject: [PATCH] fail with error when running diagnostic in offline mode --- core/commands/diag.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/commands/diag.go b/core/commands/diag.go index ecdf6564e..2152b9d49 100644 --- a/core/commands/diag.go +++ b/core/commands/diag.go @@ -2,6 +2,7 @@ package commands import ( "encoding/json" + "errors" "io" "time" @@ -9,6 +10,9 @@ import ( ) func Diag(n *core.IpfsNode, args []string, opts map[string]interface{}, out io.Writer) error { + if n.Diagnostics == nil { + return errors.New("Cannot run diagnostic in offline mode!") + } info, err := n.Diagnostics.GetDiagnostic(time.Second * 20) if err != nil { return err