Added is_inside_tree() check in both Timer and Tween
Tween now throws error and doesnt even execute.
This commit is contained in:
parent
00aabec8bb
commit
5e337b31eb
@ -783,10 +783,12 @@ float Tween::get_speed_scale() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Tween::start() {
|
bool Tween::start() {
|
||||||
|
|
||||||
|
ERR_FAIL_COND_V_MSG(!is_inside_tree(), false, "Tween was not added to the SceneTree!");
|
||||||
|
|
||||||
// Are there any pending updates?
|
// Are there any pending updates?
|
||||||
if (pending_update != 0) {
|
if (pending_update != 0) {
|
||||||
// Start the tweens after deferring
|
// Start the tweens after deferring
|
||||||
call_deferred("start");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2149,9 +2149,7 @@ bool Control::has_focus() const {
|
|||||||
|
|
||||||
void Control::grab_focus() {
|
void Control::grab_focus() {
|
||||||
|
|
||||||
if (!is_inside_tree()) {
|
|
||||||
ERR_FAIL_COND(!is_inside_tree());
|
ERR_FAIL_COND(!is_inside_tree());
|
||||||
}
|
|
||||||
|
|
||||||
if (data.focus_mode == FOCUS_NONE) {
|
if (data.focus_mode == FOCUS_NONE) {
|
||||||
WARN_PRINT("This control can't grab focus. Use set_focus_mode() to allow a control to get focus.");
|
WARN_PRINT("This control can't grab focus. Use set_focus_mode() to allow a control to get focus.");
|
||||||
|
@ -107,6 +107,9 @@ bool Timer::has_autostart() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Timer::start(float p_time) {
|
void Timer::start(float p_time) {
|
||||||
|
|
||||||
|
ERR_FAIL_COND_MSG(!is_inside_tree(), "Timer was not added to the SceneTree!");
|
||||||
|
|
||||||
if (p_time > 0) {
|
if (p_time > 0) {
|
||||||
set_wait_time(p_time);
|
set_wait_time(p_time);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user