nkanaev / yarr

yet another rss reader
MIT License
3.02k stars 225 forks source link

Error in logs: untime error: invalid memory address or nil pointer dereference #113

Closed grigio closed 2 years ago

grigio commented 2 years ago

yarr is fantastic and it works very well, I just got this error in the logs but I didn't noticed any issue. Maybe because it tried to open a non textual content via full preview

2022/10/12 14:14:32 server.go:3230: http: panic serving 192.168.1.71:41602: runtime error: invalid memory address or nil pointer dereference
goroutine 82468 [running]:
net/http.(*conn).serve.func1()
    /usr/local/go/src/net/http/server.go:1850 +0xbf
panic({0x9172a0, 0xd100b0})
    /usr/local/go/src/runtime/panic.go:890 +0x262
github.com/nkanaev/yarr/src/content/readability.getArticle(0x0, 0x97e19b?)
    /src/src/content/readability/readability.go:79 +0x15b
github.com/nkanaev/yarr/src/content/readability.ExtractContent({0xa90ec0?, 0xc00056c120?})
    /src/src/content/readability/readability.go:65 +0x271
github.com/nkanaev/yarr/src/server.(*Server).handlePageCrawl(0x8fab40?, 0xc0002a85c0)
    /src/src/server/routes.go:475 +0x258
github.com/nkanaev/yarr/src/server/router.(*Context).Next(...)
    /src/src/server/router/context.go:24
github.com/nkanaev/yarr/src/server/gzip.Middleware(0xc0002a85c0)
    /src/src/server/gzip/middleware.go:42 +0x256
github.com/nkanaev/yarr/src/server/router.(*Context).Next(...)
    /src/src/server/router/context.go:24
github.com/nkanaev/yarr/src/server/router.(*Router).ServeHTTP(0xc00015ca40, {0xa93a88?, 0xc00060e540}, 0xc0000c6100)
    /src/src/server/router/router.go:81 +0x310
net/http.serverHandler.ServeHTTP({0xc00007b500?}, {0xa93a88, 0xc00060e540}, 0xc0000c6100)
    /usr/local/go/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc000270140, {0xa94000, 0xc0001dd020})
    /usr/local/go/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
    /usr/local/go/src/net/http/server.go:3102 +0x4db
nkanaev commented 2 years ago

fixed in https://github.com/nkanaev/yarr/commit/e62906e63dee06492e4ed5f659f251394ba2a1c6. thanks for the report!

nkanaev commented 2 years ago

the error was caused by the readability functionality failing to extract content. minor error, shouldn't affect the application overall.

grigio commented 2 years ago

Thanks!