Fix NPE in `AllMethodsTraverserImpl`

Fixes #1002217