Commit e336bd5
committed
fix(http): avoid typed-nil pool panic on Serve failure; clarify attr error
NewPool returns a concrete *static_pool.Pool, so assigning its result
directly to the api.Pool interface field on the error path boxed a typed
nil into p.pool. The simplified Stop guard (`if p.pool != nil`) then sees
a non-nil interface and calls Destroy on the nil receiver, which panics
(Destroy dereferences sp.log immediately). Assign to p.pool only when the
returned pointer is non-nil so the interface never holds a typed nil and
the existing guard stays correct.
Also distinguish the wrong-type case in attributes.Set from the
missing-key case with its own error message for easier diagnosis.1 parent ba9070b commit e336bd5
2 files changed
Lines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
131 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
132 | 135 | | |
133 | 136 | | |
134 | 137 | | |
135 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
136 | 142 | | |
137 | 143 | | |
138 | 144 | | |
| |||
0 commit comments