mirror of
https://github.com/status-im/whispervis.git
synced 2025-02-08 03:15:09 +00:00
Prevent crash when localstorage contains invalide network preset
This commit is contained in:
parent
7dc84bc5c7
commit
1e09bf634d
@ -94,13 +94,19 @@ func (n *NetworkSelector) descriptionBlock() *vecty.HTML {
|
|||||||
func (n *NetworkSelector) networkOptions() vecty.List {
|
func (n *NetworkSelector) networkOptions() vecty.List {
|
||||||
var options vecty.List
|
var options vecty.List
|
||||||
for name := range n.networks {
|
for name := range n.networks {
|
||||||
options = append(options, elem.Option(
|
currentName := "none"
|
||||||
|
if n.current != nil {
|
||||||
|
currentName = n.current.Name
|
||||||
|
}
|
||||||
|
|
||||||
|
opt := elem.Option(
|
||||||
vecty.Markup(
|
vecty.Markup(
|
||||||
vecty.Property("value", name),
|
vecty.Property("value", name),
|
||||||
vecty.Property("selected", n.current.Name == "data/"+name), // TODO(divan): get rid of "data"
|
vecty.Property("selected", currentName == "data/"+name), // TODO(divan): get rid of "data"
|
||||||
),
|
),
|
||||||
vecty.Text(name),
|
vecty.Text(name),
|
||||||
))
|
)
|
||||||
|
options = append(options, opt)
|
||||||
}
|
}
|
||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user