Skip to content

Commit 4ca8a5a

Browse files
authored
swapping around and to avoid null ptr deref (#389)
# Description Addressing issue #388 by swapping around the `addRoomToMemory` and `SaveRoomTemplate` function calls in the `CreateZone` function. ## Changes - Calling `addRoomToMemory` before `SaveRoomTemplate` in `CreateZone`.
1 parent 65f6a74 commit 4ca8a5a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/rooms/roommanager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,11 +696,11 @@ func CreateZone(zoneName string) (roomId int, err error) {
696696
return 0, err
697697
}
698698

699+
addRoomToMemory(newRoom)
700+
699701
// save to the flat file
700702
SaveRoomTemplate(*newRoom)
701703

702-
addRoomToMemory(newRoom)
703-
704704
// write room to the folder under the new ID
705705
return newRoom.RoomId, nil
706706
}

0 commit comments

Comments
 (0)