1
0
mirror of https://github.com/golang/go synced 2024-11-19 13:34:45 -07:00

cmd/pprof: fix crash with invalid source

pprof crashed when running with:

     go tool pprof %INVALID

Change-Id: I47c2a4da7273e3a97a833f320a650b8c6b59d6b9
Reviewed-on: https://go-review.googlesource.com/20632
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Egon Elbre 2016-03-12 21:09:14 +02:00 committed by Brad Fitzpatrick
parent af1c29c1c1
commit 69f49e1cbc

View File

@ -139,7 +139,7 @@ func adjustURL(source string, sec int, ui plugin.UI) (adjusted, host string, dur
if err != nil || (url.Host == "" && url.Scheme != "" && url.Scheme != "file") {
url, err = url.Parse("http://" + source)
if err != nil {
return source, url.Host, time.Duration(30) * time.Second
return source, "", 0
}
}
if scheme := strings.ToLower(url.Scheme); scheme == "" || scheme == "file" {