Skip to content

Commit

Permalink
Add error handling for room not found in change_room function
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackRam-oss committed Jan 29, 2024
1 parent 0dd54ed commit 63b9e69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion game/nqtr_tool/nav_label_fun.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ define block_goout_dialogue = _("Now is not the time to go outside")
# Wiki: https://github.com/DRincs-Productions/NQTR-toolkit/wiki/Navigation-and-Map#change-room
label change_room(room_id = None):
if room_id:
$ new_room = get_room_by_id(room_id = room_id, rooms = rooms)
if new_room is None:
$ log_error("Room with id [room_id] not found")
return
python:
new_room = get_room_by_id(room_id = room_id, rooms = rooms)
prev_room = cur_room
cur_room = new_room
del new_room
Expand Down
1 change: 1 addition & 0 deletions pythonpackages/nqtr/navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ def get_room_by_id(room_id: str, rooms: list[Room]) -> Optional[Room]:
for room in rooms:
if room.id == room_id:
return room
log_warn(f"Room with id {room_id} not found", "nqtr.navigation.get_room_by_id()")
return


Expand Down

0 comments on commit 63b9e69

Please sign in to comment.