Fix redstone comparator flooding crash by erlehmann #2027

Merged
cora merged 1 commits from fix-comparator-crash into master 2022-02-24 22:35:14 +01:00
Contributor

Redstone comparators have two modes, comparison mode & subtraction mode.
Before this patch, the functions to turn comparators on or off attempted
to swap nodes with comparators in the same mode, but failed to determine
the correct replacement node, if the existing node was not a comparator.

When a comparator in an on state (e.g. powered by a filled cauldron) was
flooded, the flooding dropped the comparator and replaced the comparator
node that was to be swapped out with air, which lead to a server crash.

This patch changes the functions that turn comparators on or off so they
only swap existing nodes with comparators in the same mode if the name
of the replacement node can be determined – i.e. if it is not nil.

Redstone comparators have two modes, comparison mode & subtraction mode. Before this patch, the functions to turn comparators on or off attempted to swap nodes with comparators in the same mode, but failed to determine the correct replacement node, if the existing node was not a comparator. When a comparator in an on state (e.g. powered by a filled cauldron) was flooded, the flooding dropped the comparator and replaced the comparator node that was to be swapped out with air, which lead to a server crash. This patch changes the functions that turn comparators on or off so they only swap existing nodes with comparators in the same mode if the name of the replacement node can be determined – i.e. if it is not nil.
cora added 1 commit 2022-02-24 20:10:02 +01:00
41550da87b Fix redstone comparator flooding crash
Redstone comparators have two modes, comparison mode & subtraction mode.
Before this patch, the functions to turn comparators on or off attempted
to swap nodes with comparators in the same mode, but failed to determine
the correct replacement node, if the existing node was not a comparator.

When a comparator in an on state (e.g. powered by a filled cauldron) was
flooded, the flooding dropped the comparator and replaced the comparator
node that was to be swapped out with air, which lead to a server crash.

This patch changes the functions that turn comparators on or off so they
only swap existing nodes with comparators in the same mode if the name
of the replacement node can be determined – i.e. if it is not nil.
Author
Contributor

I'm merging this since it was extensively tested in mcla ( Mineclonia/Mineclonia#284 ). I verified that it works in mcl2 too ofc.

I'm merging this since it was extensively tested in mcla ( https://git.minetest.land/Mineclonia/Mineclonia/pulls/284 ). I verified that it works in mcl2 too ofc.
cora merged commit 85e0e23c76 into master 2022-02-24 22:35:14 +01:00
cora deleted branch fix-comparator-crash 2022-02-24 22:35:21 +01:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: VoxeLibre/VoxeLibre#2027
No description provided.