Skip to content

Commit

Permalink
Better error message on empty clipboards
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed Jul 24, 2016
1 parent 83e47fa commit 6f693fa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 6f693fa

Please sign in to comment.