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

Prevent CD error on attempting to disable the CD's Lock #2960

Merged
merged 3 commits into from
Jan 4, 2024

Conversation

DerelictDrone
Copy link
Member

@DerelictDrone DerelictDrone commented Dec 28, 2023

When disabling a CD Lock with the "Disable" wire input while it's holding a CD, it will cause an error due to attempting to index an entity/table that doesn't exist.

This will check if the disk exists on self before attempting to remove the lock on it, preventing the error.

Vurv78
Vurv78 previously requested changes Dec 28, 2023
@@ -97,7 +97,9 @@ function ENT:AttachDisk(disk)

self.Const:CallOnRemove("wire_cd_remove_on_weld",function()
self.Const = nil
self.Disk.Lock = nil
if(IsValid(self.Disk)) then
Copy link
Contributor

Choose a reason for hiding this comment

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

Redundant parens, also it doesn't need to be valid but w/e

Copy link
Member Author

@DerelictDrone DerelictDrone Dec 28, 2023

Choose a reason for hiding this comment

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

Was following the isvalid check on file line 61, which I'd believed to be in the primary style of the rest of the file but it turns out it's just wildly inconsistent throughout the file anyway

@thegrb93 thegrb93 merged commit e1b30fb into wiremod:master Jan 4, 2024
1 check failed
@DerelictDrone DerelictDrone deleted the cdlock branch January 4, 2024 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants