Skip to content

Conversation

@tehsphinx
Copy link
Contributor

@tehsphinx tehsphinx commented Mar 14, 2022

There is a nil pointer exception because the code assigns a nil value to an interface (e.Listener) which ends up creating a non-nil interface containing a nil pointer. Using this will result in the nil pointer exception and checking the e.Listener against nil will be false -- which is why the Listener is not recreated and overwritten the during the second call to Start.

Small code example that triggers this error (given an existing echo router):

if err := e.Start(":6060"); err != nil { // retry with random port if r := e.Start(":"); r != nil { log.Fatal(r)	} }
@codecov
Copy link

codecov bot commented Mar 14, 2022

Codecov Report

Merging #2131 (8bcff16) into master (b445958) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@ Coverage Diff @@ ## master #2131 +/- ## ======================================= Coverage 92.10% 92.11% ======================================= Files 37 37 Lines 3028 3030 +2 ======================================= + Hits 2789 2791 +2  Misses 150 150 Partials 89 89 
Impacted Files Coverage Δ
echo.go 95.17% <100.00%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b445958...8bcff16. Read the comment docs.

Copy link
Contributor

@aldas aldas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aldas aldas merged commit 05df10c into labstack:master Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants