Skip to content

Commit da4df2a

Browse files
committed
Fix ternary operator compilation error for erasing list node
1 parent 54754d6 commit da4df2a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

core/types/list.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,14 @@ String LinkedList::to_string() {
408408
return str;
409409
}
410410

411+
void ListNode::erase() {
412+
if (data) {
413+
data->erase(this);
414+
} else {
415+
memdelete(this);
416+
}
417+
}
418+
411419
void ListNode::_bind_methods() {
412420
ClassDB::bind_method(D_METHOD("get_next"), &ListNode::get_next);
413421
ClassDB::bind_method(D_METHOD("get_prev"), &ListNode::get_prev);

core/types/list.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ListNode : public Object {
3939
Variant get_value() { return value; }
4040
void set_value(const Variant &p_value) { value = p_value; }
4141

42-
void erase() { data ? data->erase(this) : memdelete(this); }
42+
void erase();
4343

4444
virtual String to_string() { return String(value); }
4545

0 commit comments

Comments
 (0)