]> Sergey Matveev's repositories - btrtrc.git/commitdiff
torrent.String, if the name isn't available, use the info hash
authorMatt Joiner <anacrolix@gmail.com>
Mon, 1 Dec 2014 20:29:30 +0000 (14:29 -0600)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 1 Dec 2014 20:29:30 +0000 (14:29 -0600)
torrent.go

index 78162aa07d295ed9b5918374db662d22e4030928..1e4302b74ab6e86655741adcc91d1eec13ac5289 100644 (file)
@@ -344,7 +344,11 @@ func (t *torrent) WriteStatus(w io.Writer) {
 }
 
 func (t *torrent) String() string {
-       return t.Name()
+       s := t.Name()
+       if s == "" {
+               s = fmt.Sprintf("%x", t.InfoHash)
+       }
+       return s
 }
 
 func (t *torrent) haveInfo() bool {