From 7ae8e8d8ee245640203b5993341c1b8ed9a0bcfa Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Sun, 5 Aug 2018 09:01:00 -0700 Subject: [PATCH] Fixing #107 --- app/app.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/app.go b/app/app.go index f2beb32..406e8c2 100644 --- a/app/app.go +++ b/app/app.go @@ -70,12 +70,15 @@ func (app *Application) startTor(torPath string) error { // SetProfile loads an existing profile from the given filename. func (app *Application) SetProfile(filename string, password string) error { - profile, err := peer.LoadCwtchPeer(path.Join(app.directory, filename), password) - if err != nil { - return err + if app.Peer == nil { + profile, err := peer.LoadCwtchPeer(path.Join(app.directory, filename), password) + if err != nil { + return err + } + app.Peer = profile + return app.startPeer() } - app.Peer = profile - return app.startPeer() + return errors.New("profile is already loaded, to load a different profile you will need to restart the application") } func (app *Application) startPeer() error {