Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes a runtime with SecurEye and updates bodycamera descriptions #4103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/game/objects/items/bodycamera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
if(in_range(src, user))
. += "<span class='notice'>The body camera is set to a nametag of '<b>[c_tag]</b>'.</span>"
. += "<span class='notice'>The body camera is set to transmit on the '<b>[network[1]]</b>' network.</span>"
. += "<span class='notice'>It looks like you can modify the camera settings by using a <b>multitool<b> on it.</span>"
. += "<span class='notice'>It looks like you can modify the camera settings by using a <b>multitool</b> on it.</span>"

/obj/item/bodycamera/AltClick(mob/user)
. = ..()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@

var/list/visible_turfs = list()

if(!active_camera.loc)
if(!active_camera)
show_camera_static()
return
else if (active_camera.loc == null)
show_camera_static()
Comment on lines +176 to +180
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason not to slap an OR here instead?

Copy link
Contributor Author

@zimon9 zimon9 Feb 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason it's staggered like this is because if no active camera is selected, the reference would be set to null, and this was causing runtimes when active_camera was null (because null.loc would throw a runtime)

This should check if active_camera is not null first, and then evaluate if the location is null

Truth be told, I could've made lines 179 through 181 their own if function instead of chaining it up with the if function starting at line 176, but the behavior is functionally the same

return

var/cam_location = active_camera.loc
Expand Down
Loading