Thanks for pointing it out :)

The listDefinedNetworks will return only the inactive networks and the listNetworks will give you the active ones, so I merged both list before checking if the given bridge name is there.