The code or the result? The result should be the same - you'll get an NPE if

* networks is null
* any network in networks is empty or null

Or do you mean keeping the _error message_ the same?