diff options
Diffstat (limited to 'models/git_diff.go')
-rw-r--r-- | models/git_diff.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/models/git_diff.go b/models/git_diff.go index 1b2fb5f2b1..22075ef76b 100644 --- a/models/git_diff.go +++ b/models/git_diff.go @@ -246,8 +246,8 @@ func ParsePatch(maxlines int, reader io.Reader) (*Diff, error) { buf.WriteString("\n") } } - charsetLabel := base.DetectEncoding(buf.Bytes()) - if charsetLabel != "UTF-8" { + charsetLabel, err := base.DetectEncoding(buf.Bytes()) + if charsetLabel != "UTF-8" && err == nil { encoding, _ := charset.Lookup(charsetLabel) if encoding != nil { d := encoding.NewDecoder() |