From 6f693fa8ae3b10b0e1383437bd9f75a769cb8245 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 25 Jul 2016 00:53:35 +0200 Subject: [PATCH] Better error message on empty clipboards --- client.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index b80138d..05208fc 100644 --- a/client.go +++ b/client.go @@ -92,9 +92,13 @@ func (client *Client) pasteOperation(h1 []byte, isMove bool) { log.Fatal(err) } rbuf := make([]byte, 112) - if _, err := io.ReadFull(reader, rbuf); err != nil { + if nbread, err := io.ReadFull(reader, rbuf); err != nil { if err == io.ErrUnexpectedEOF { - log.Fatal("The server may be running an incompatible version") + if nbread < 80 { + log.Fatal("The clipboard might be empty") + } else { + log.Fatal("The server may be running an incompatible version") + } } else { log.Fatal(err) }