Fix crash upon adding variable in the plan editor with empty default name
Also default to float when expected type is not specified.
This commit is contained in:
parent
dc77ecd2b2
commit
b54f3696ff
|
@ -48,7 +48,7 @@ void BlackboardPlanEditor::_add_var() {
|
|||
ERR_FAIL_NULL(plan);
|
||||
|
||||
int suffix = 1;
|
||||
StringName var_name = default_var_name;
|
||||
StringName var_name = default_var_name == StringName() ? "var" : default_var_name;
|
||||
while (plan->has_var(var_name)) {
|
||||
suffix += 1;
|
||||
var_name = String(default_var_name) + itos(suffix);
|
||||
|
|
|
@ -106,7 +106,8 @@ void EditorPropertyVariableName::_status_pressed() {
|
|||
ERR_FAIL_NULL(plan);
|
||||
if (!plan->has_var(name_edit->get_text())) {
|
||||
BlackboardPlanEditor::get_singleton()->set_defaults(name_edit->get_text(),
|
||||
expected_type, default_hint, default_hint_string, default_value);
|
||||
expected_type == Variant::NIL ? Variant::FLOAT : expected_type,
|
||||
default_hint, default_hint_string, default_value);
|
||||
}
|
||||
BlackboardPlanEditor::get_singleton()->edit_plan(plan);
|
||||
BlackboardPlanEditor::get_singleton()->popup_centered();
|
||||
|
|
Loading…
Reference in New Issue