diff options
author | Valery Piashchynski <[email protected]> | 2020-02-28 15:50:10 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-02-28 15:50:10 +0300 |
commit | e5c9caef71beb46b82dee4e2c2d8d24f93249c46 (patch) | |
tree | aab70eadc22021a0cd3e31fe794d31989cdbe491 /service | |
parent | dd75a23048117cfc8290d230b2ed88d93b4941d6 (diff) |
NPE when trying to get workers[0]
Diffstat (limited to 'service')
-rw-r--r-- | service/limit/service_test.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/service/limit/service_test.go b/service/limit/service_test.go index c21d0419..6285f213 100644 --- a/service/limit/service_test.go +++ b/service/limit/service_test.go @@ -391,6 +391,10 @@ func Test_Service_Listener_MaxMemoryUsage(t *testing.T) { } } func getPID(s interface{}) string { - w := s.(*rrhttp.Service).Server().Workers()[0] - return fmt.Sprintf("%v", *w.Pid) + if len(s.(*rrhttp.Service).Server().Workers()) > 0 { + w := s.(*rrhttp.Service).Server().Workers()[0] + return fmt.Sprintf("%v", *w.Pid) + } else { + panic("no workers") + } } |