Add null checking for paramaters in Undoredo

This commit is contained in:
geequlim 2018-01-07 18:47:55 +08:00
parent 29e68aa40e
commit a6e0dcdcbf

View file

@ -108,6 +108,7 @@ void UndoRedo::create_action(const String &p_name, MergeMode p_mode) {
void UndoRedo::add_do_method(Object *p_object, const String &p_method, VARIANT_ARG_DECLARE) { void UndoRedo::add_do_method(Object *p_object, const String &p_method, VARIANT_ARG_DECLARE) {
VARIANT_ARGPTRS VARIANT_ARGPTRS
ERR_FAIL_COND(p_object == NULL);
ERR_FAIL_COND(action_level <= 0); ERR_FAIL_COND(action_level <= 0);
ERR_FAIL_COND((current_action + 1) >= actions.size()); ERR_FAIL_COND((current_action + 1) >= actions.size());
Operation do_op; Operation do_op;
@ -127,6 +128,7 @@ void UndoRedo::add_do_method(Object *p_object, const String &p_method, VARIANT_A
void UndoRedo::add_undo_method(Object *p_object, const String &p_method, VARIANT_ARG_DECLARE) { void UndoRedo::add_undo_method(Object *p_object, const String &p_method, VARIANT_ARG_DECLARE) {
VARIANT_ARGPTRS VARIANT_ARGPTRS
ERR_FAIL_COND(p_object == NULL);
ERR_FAIL_COND(action_level <= 0); ERR_FAIL_COND(action_level <= 0);
ERR_FAIL_COND((current_action + 1) >= actions.size()); ERR_FAIL_COND((current_action + 1) >= actions.size());
@ -149,6 +151,7 @@ void UndoRedo::add_undo_method(Object *p_object, const String &p_method, VARIANT
} }
void UndoRedo::add_do_property(Object *p_object, const String &p_property, const Variant &p_value) { void UndoRedo::add_do_property(Object *p_object, const String &p_property, const Variant &p_value) {
ERR_FAIL_COND(p_object == NULL);
ERR_FAIL_COND(action_level <= 0); ERR_FAIL_COND(action_level <= 0);
ERR_FAIL_COND((current_action + 1) >= actions.size()); ERR_FAIL_COND((current_action + 1) >= actions.size());
Operation do_op; Operation do_op;
@ -163,6 +166,7 @@ void UndoRedo::add_do_property(Object *p_object, const String &p_property, const
} }
void UndoRedo::add_undo_property(Object *p_object, const String &p_property, const Variant &p_value) { void UndoRedo::add_undo_property(Object *p_object, const String &p_property, const Variant &p_value) {
ERR_FAIL_COND(p_object == NULL);
ERR_FAIL_COND(action_level <= 0); ERR_FAIL_COND(action_level <= 0);
ERR_FAIL_COND((current_action + 1) >= actions.size()); ERR_FAIL_COND((current_action + 1) >= actions.size());
@ -182,6 +186,7 @@ void UndoRedo::add_undo_property(Object *p_object, const String &p_property, con
} }
void UndoRedo::add_do_reference(Object *p_object) { void UndoRedo::add_do_reference(Object *p_object) {
ERR_FAIL_COND(p_object == NULL);
ERR_FAIL_COND(action_level <= 0); ERR_FAIL_COND(action_level <= 0);
ERR_FAIL_COND((current_action + 1) >= actions.size()); ERR_FAIL_COND((current_action + 1) >= actions.size());
Operation do_op; Operation do_op;
@ -194,6 +199,7 @@ void UndoRedo::add_do_reference(Object *p_object) {
} }
void UndoRedo::add_undo_reference(Object *p_object) { void UndoRedo::add_undo_reference(Object *p_object) {
ERR_FAIL_COND(p_object == NULL);
ERR_FAIL_COND(action_level <= 0); ERR_FAIL_COND(action_level <= 0);
ERR_FAIL_COND((current_action + 1) >= actions.size()); ERR_FAIL_COND((current_action + 1) >= actions.size());