Skip to content
Browse files

Fix that horrible panicking death that happens when the queue is empty.

  • Loading branch information...
1 parent f20b146 commit 8c8441170a499aa0911973dcf5d4c41fbb5e792d @alloy-d committed Sep 21, 2010
Showing with 7 additions and 2 deletions.
  1. +7 −2 tools/now/now.go
View
9 tools/now/now.go
@@ -36,7 +36,10 @@ func getNext() string {
var out interface{}
json.Unmarshal(buf.Bytes(), &out)
- return out.(string)
+ if out != nil {
+ return out.(string)
+ }
+ return ""
}
func main() {
@@ -48,5 +51,7 @@ func main() {
thing := getNext()
- fmt.Println(thing)
+ if thing != "" {
+ fmt.Println(thing)
+ }
}

0 comments on commit 8c84411

Please sign in to comment.
Something went wrong with that request. Please try again.