chaitin / strapdown-zeta

Instant and elegant Markdown documents in the browser, Git powered markdown wiki server, mathjax and theme support, and many more features!
http://strapdown.ztx.io
Other
166 stars 44 forks source link

diff runtime error #73

Closed jamesliu96 closed 9 years ago

jamesliu96 commented 9 years ago

by requesting non-existing version hash diff I get an EMPTY_RESPONSE error from browser and a runtime error from the server. the error prompt is such,

2015/11/06 16:57:33 http: panic serving 127.0.0.1:61408: runtime error: invalid memory address or nil pointer dereference
goroutine 28 [running]:
net/http.(*conn).serve.func1(0xc8202ca840, 0x4e660c0, 0xc8202c81c0)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1287 +0xb5
main.(*RequestContext).Diff(0xc8205544b0, 0xc8202c3a20, 0x2, 0x2, 0x0, 0x0)
    /var/data/git/strapdown-zeta/server/action.go:257 +0x48a
main.handleFunc(0x4e66240, 0xc8203a2420, 0xc8200e1180)
    /var/data/git/strapdown-zeta/server/strapdown-server.go:355 +0x10ed
net/http.HandlerFunc.ServeHTTP(0x45aadd0, 0x4e66240, 0xc8203a2420, 0xc8200e1180)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1422 +0x3a
net/http.(*ServeMux).ServeHTTP(0xc820016c00, 0x4e66240, 0xc8203a2420, 0xc8200e1180)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1699 +0x17d
net/http.serverHandler.ServeHTTP(0xc82001ab40, 0x4e66240, 0xc8203a2420, 0xc8200e1180)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1862 +0x19e
net/http.(*conn).serve(0xc8202ca840)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1361 +0xbee
created by net/http.(*Server).Serve
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1910 +0x3f6
2015/11/06 16:57:33 [ GET ] - 200 /?diff=a01dc345cb4,54f49e753501
2015/11/06 16:57:33 http: panic serving 127.0.0.1:61410: runtime error: invalid memory address or nil pointer dereference
goroutine 40 [running]:
net/http.(*conn).serve.func1(0xc8203a22c0, 0x4e660c0, 0xc8203a0088)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1287 +0xb5
main.(*RequestContext).Diff(0xc8205545a0, 0xc8202c3b40, 0x2, 0x2, 0x0, 0x0)
    /var/data/git/strapdown-zeta/server/action.go:257 +0x48a
main.handleFunc(0x4e66240, 0xc8203a24d0, 0xc8202e2460)
    /var/data/git/strapdown-zeta/server/strapdown-server.go:355 +0x10ed
net/http.HandlerFunc.ServeHTTP(0x45aadd0, 0x4e66240, 0xc8203a24d0, 0xc8202e2460)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1422 +0x3a
net/http.(*ServeMux).ServeHTTP(0xc820016c00, 0x4e66240, 0xc8203a24d0, 0xc8202e2460)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1699 +0x17d
net/http.serverHandler.ServeHTTP(0xc82001ab40, 0x4e66240, 0xc8203a24d0, 0xc8202e2460)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1862 +0x19e
net/http.(*conn).serve(0xc8203a22c0)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1361 +0xbee
created by net/http.(*Server).Serve
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1910 +0x3f6
2015/11/06 16:57:33 [ GET ] - 200 /?diff=a01dc345cb4,54f49e753501
2015/11/06 16:57:33 http: panic serving 127.0.0.1:61412: runtime error: invalid memory address or nil pointer dereference
goroutine 41 [running]:
net/http.(*conn).serve.func1(0xc8203a2580, 0x4e660c0, 0xc8203a00f0)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1287 +0xb5
main.(*RequestContext).Diff(0xc820554690, 0xc8202c3ce0, 0x2, 0x2, 0x0, 0x0)
    /var/data/git/strapdown-zeta/server/action.go:257 +0x48a
main.handleFunc(0x4e66240, 0xc8203a2630, 0xc8202e2540)
    /var/data/git/strapdown-zeta/server/strapdown-server.go:355 +0x10ed
net/http.HandlerFunc.ServeHTTP(0x45aadd0, 0x4e66240, 0xc8203a2630, 0xc8202e2540)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1422 +0x3a
net/http.(*ServeMux).ServeHTTP(0xc820016c00, 0x4e66240, 0xc8203a2630, 0xc8202e2540)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1699 +0x17d
net/http.serverHandler.ServeHTTP(0xc82001ab40, 0x4e66240, 0xc8203a2630, 0xc8202e2540)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1862 +0x19e
net/http.(*conn).serve(0xc8203a2580)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1361 +0xbee
created by net/http.(*Server).Serve
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1910 +0x3f6
2015/11/06 16:57:33 [ GET ] - 200 /?diff=a01dc345cb4,54f49e753501
2015/11/06 16:57:33 http: panic serving 127.0.0.1:61414: runtime error: invalid memory address or nil pointer dereference
goroutine 42 [running]:
net/http.(*conn).serve.func1(0xc8203a26e0, 0x4e660c0, 0xc8203a0120)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1287 +0xb5
main.(*RequestContext).Diff(0xc820554780, 0xc8202c3e80, 0x2, 0x2, 0x0, 0x0)
    /var/data/git/strapdown-zeta/server/action.go:257 +0x48a
main.handleFunc(0x4e66240, 0xc8203a2790, 0xc8202e2620)
    /var/data/git/strapdown-zeta/server/strapdown-server.go:355 +0x10ed
net/http.HandlerFunc.ServeHTTP(0x45aadd0, 0x4e66240, 0xc8203a2790, 0xc8202e2620)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1422 +0x3a
net/http.(*ServeMux).ServeHTTP(0xc820016c00, 0x4e66240, 0xc8203a2790, 0xc8202e2620)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1699 +0x17d
net/http.serverHandler.ServeHTTP(0xc82001ab40, 0x4e66240, 0xc8203a2790, 0xc8202e2620)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1862 +0x19e
net/http.(*conn).serve(0xc8203a26e0)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1361 +0xbee
created by net/http.(*Server).Serve
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1910 +0x3f6
2015/11/06 16:57:38 [ GET ] - 200 /?diff=a01dc345cb4,54f49e753501
2015/11/06 16:57:38 http: panic serving 127.0.0.1:61416: runtime error: invalid memory address or nil pointer dereference
goroutine 43 [running]:
net/http.(*conn).serve.func1(0xc8203a2840, 0x4e660c0, 0xc8203a0150)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1287 +0xb5
main.(*RequestContext).Diff(0xc820554870, 0xc8201a6060, 0x2, 0x2, 0x0, 0x0)
    /var/data/git/strapdown-zeta/server/action.go:257 +0x48a
main.handleFunc(0x4e66240, 0xc8203a28f0, 0xc8202e2700)
    /var/data/git/strapdown-zeta/server/strapdown-server.go:355 +0x10ed
net/http.HandlerFunc.ServeHTTP(0x45aadd0, 0x4e66240, 0xc8203a28f0, 0xc8202e2700)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1422 +0x3a
net/http.(*ServeMux).ServeHTTP(0xc820016c00, 0x4e66240, 0xc8203a28f0, 0xc8202e2700)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1699 +0x17d
net/http.serverHandler.ServeHTTP(0xc82001ab40, 0x4e66240, 0xc8203a28f0, 0xc8202e2700)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1862 +0x19e
net/http.(*conn).serve(0xc8203a2840)
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1361 +0xbee
created by net/http.(*Server).Serve
    /usr/local/go/1.5.1/libexec/src/net/http/server.go:1910 +0x3f6

an error page should replace the empty response and the server-side runtime error should be handled.