Fix crash on read Networks when not connected (#19588)
Fix crash on read Networks when not connected (#19588)

* Fix crash on read Networks when not connected

This happens when running the example apps on linux with the wifi
feature enabled (--wifi) because the device is actually connected
via ethernet and wifi is not connected. This could happen in a prod
device if > 1 network type was supported.

Fixes #19585

* Restyled by clang-format

Co-authored-by: Restyled.io <eb8d3fd3977bb570908ffc25e24391520747defb@restyled.io>
nestlabs/connectedhomeip,nestlabs/connectedhomeip,nestlabs/connectedhomeip,project-chip/connectedhomeip,project-chip/connectedhomeip,nestlabs/connectedhomeip,nestlabs/connectedhomeip,project-chip/connectedhomeip,nestlabs/connectedhomeip,project-chip/connectedhomeip,project-chip/connectedhomeip,project-chip/connectedhomeip,nestlabs/connectedhomeip