From 6d967441ac4ec1ba2c9c811cba92a092fbfd9667 Mon Sep 17 00:00:00 2001 From: "Jonathan Leibiusky (@xetorthio)" Date: Fri, 11 Nov 2016 09:16:01 -0300 Subject: [PATCH] If instance doesn't exist don't try to connect to its terminal --- build.sh | 2 +- services/client.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 4e72fe1..d5c0888 100755 --- a/build.sh +++ b/build.sh @@ -1,3 +1,3 @@ #!/bin/bash -docker build -t builder .&& docker run --rm builder | sudo docker build -t franela/play-with-docker:master - +docker build -t builder .&& docker run --rm builder | sudo docker build -t franela/play-with-docker:latest - diff --git a/services/client.go b/services/client.go index b805e70..d8a5756 100644 --- a/services/client.go +++ b/services/client.go @@ -25,7 +25,7 @@ func NewClient(so socketio.Socket, session *Session) *Client { so.On("terminal in", func(name, data string) { // User wrote something on the terminal. Need to write it to the instance terminal instance := GetInstance(session, name) - if len(data) > 0 { + if instance != nil && len(data) > 0 { instance.Conn.Conn.Write([]byte(data)) } })