Skip to content

Commit

Permalink
Handle error when saving to IP address store
Browse files Browse the repository at this point in the history
  • Loading branch information
z-riley committed Nov 8, 2024
1 parent cee61e3 commit fb9ce26
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions screen/multiplayer_join.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (s *MultiplayerJoinScreen) Enter(_ InitData) {
s.ipStore = store.NewStore(".ip.bruh")
b, err := s.ipStore.ReadBytes()
if err != nil {
log.Println("Failed to read IP store:", err)
log.Println("Failed to read IP address store:", err)
b = []byte("Enter IP address")
}

Expand All @@ -90,7 +90,9 @@ func (s *MultiplayerJoinScreen) Enter(_ InitData) {
turdgl.Vec{X: 600 - 400/2, Y: s.ipHeading.Pos().Y + 15},
string(b),
).SetModifiedCB(func() {
s.ipStore.SaveBytes([]byte(s.ipEntry.Text()))
if err := s.ipStore.SaveBytes([]byte(s.ipEntry.Text())); err != nil {
log.Println("Failed to save IP address to store")
}
})

s.opponentStatus = turdgl.NewText(
Expand Down

0 comments on commit fb9ce26

Please sign in to comment.