diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-07-01 14:59:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-01 14:59:29 +0200 |
commit | 6b30f284a0544972f761be3e92ad8d1b176c9f9f (patch) | |
tree | 5edd19124ce8c9265a869a8171541d5ff7c60e17 | |
parent | b0ce9401ffa731cc346ab6762fd0794709634428 (diff) | |
parent | 7d8d337b2c47df88498067ff9091386691242144 (diff) |
Merge pull request #29980 from Dentrax/directed-by-qarmin
Fix some editor crashes
-rw-r--r-- | core/image.cpp | 2 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.cpp | 1 | ||||
-rw-r--r-- | modules/bullet/rigid_body_bullet.cpp | 4 | ||||
-rw-r--r-- | modules/gdscript/gdscript_function.cpp | 4 | ||||
-rw-r--r-- | scene/2d/canvas_item.cpp | 1 | ||||
-rw-r--r-- | scene/3d/spatial.cpp | 2 | ||||
-rw-r--r-- | scene/3d/visual_instance.cpp | 2 | ||||
-rw-r--r-- | scene/main/node.cpp | 6 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 2 | ||||
-rw-r--r-- | scene/resources/texture.cpp | 2 | ||||
-rw-r--r-- | servers/audio/effects/audio_effect_record.cpp | 3 |
11 files changed, 23 insertions, 6 deletions
diff --git a/core/image.cpp b/core/image.cpp index 4da8f27e5f..18a3aae88f 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -1372,6 +1372,7 @@ void Image::shrink_x2() { int new_size = data.size() - ofs; new_img.resize(new_size); + ERR_FAIL_COND(new_img.size() == 0); { PoolVector<uint8_t>::Write w = new_img.write(); @@ -1391,6 +1392,7 @@ void Image::shrink_x2() { ERR_FAIL_COND(!_can_modify(format)); int ps = get_format_pixel_size(format); new_img.resize((width / 2) * (height / 2) * ps); + ERR_FAIL_COND(new_img.size() == 0); { PoolVector<uint8_t>::Write w = new_img.write(); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 0f6db2dfb8..b280898188 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -4644,7 +4644,6 @@ Transform2D RasterizerStorageGLES3::multimesh_instance_get_transform_2d(RID p_mu } Color RasterizerStorageGLES3::multimesh_instance_get_color(RID p_multimesh, int p_index) const { - MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); ERR_FAIL_COND_V(!multimesh, Color()); ERR_FAIL_INDEX_V(p_index, multimesh->size, Color()); diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp index 733a900396..085cce9733 100644 --- a/modules/bullet/rigid_body_bullet.cpp +++ b/modules/bullet/rigid_body_bullet.cpp @@ -866,7 +866,7 @@ void RigidBodyBullet::on_enter_area(AreaBullet *p_area) { if (p_area->is_spOv_gravityPoint()) { ++countGravityPointSpaces; - assert(0 < countGravityPointSpaces); + ERR_FAIL_COND(countGravityPointSpaces <= 0); } } @@ -888,7 +888,7 @@ void RigidBodyBullet::on_exit_area(AreaBullet *p_area) { if (wasTheAreaFound) { if (p_area->is_spOv_gravityPoint()) { --countGravityPointSpaces; - assert(0 <= countGravityPointSpaces); + ERR_FAIL_COND(countGravityPointSpaces < 0); } --areaWhereIamCount; diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index bae5eca218..ad48aa1d28 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -1556,14 +1556,14 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a //error // function, file, line, error, explanation String err_file; - if (p_instance) + if (p_instance && p_instance->script->is_valid() && p_instance->script->path != "") err_file = p_instance->script->path; else if (script) err_file = script->path; if (err_file == "") err_file = "<built-in>"; String err_func = name; - if (p_instance && p_instance->script->name != "") + if (p_instance && p_instance->script->is_valid() && p_instance->script->name != "") err_func = p_instance->script->name + "." + err_func; int err_line = line; if (err_text == "") { diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 78e98deb93..23f6404e3e 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -1074,6 +1074,7 @@ Vector2 CanvasItem::make_canvas_position_local(const Vector2 &screen_point) cons Ref<InputEvent> CanvasItem::make_input_local(const Ref<InputEvent> &p_event) const { + ERR_FAIL_COND_V(p_event.is_null(), p_event); ERR_FAIL_COND_V(!is_inside_tree(), p_event); return p_event->xformed_by((get_canvas_transform() * get_global_transform()).affine_inverse()); diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index efd418e3c7..1a41a31253 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -506,6 +506,8 @@ bool Spatial::is_set_as_toplevel() const { Ref<World> Spatial::get_world() const { ERR_FAIL_COND_V(!is_inside_world(), Ref<World>()); + ERR_FAIL_COND_V(!data.viewport, Ref<World>()); + return data.viewport->find_world(); } diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index 4bb4d18071..5141c84803 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -60,7 +60,7 @@ void VisualInstance::_notification(int p_what) { if (skeleton) VisualServer::get_singleton()->instance_attach_skeleton( instance, skeleton->get_skeleton() ); */ - + ERR_FAIL_COND(get_world().is_null()); VisualServer::get_singleton()->instance_set_scenario(instance, get_world()->get_scenario()); _update_visibility(); diff --git a/scene/main/node.cpp b/scene/main/node.cpp index a580a7f8ac..5888760973 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -71,6 +71,8 @@ void Node::_notification(int p_notification) { } break; case NOTIFICATION_ENTER_TREE: { + ERR_FAIL_COND(!get_viewport()); + ERR_FAIL_COND(!get_tree()); if (data.pause_mode == PAUSE_MODE_INHERIT) { @@ -94,6 +96,8 @@ void Node::_notification(int p_notification) { } break; case NOTIFICATION_EXIT_TREE: { + ERR_FAIL_COND(!get_viewport()); + ERR_FAIL_COND(!get_tree()); get_tree()->node_count--; orphan_node_count++; @@ -840,6 +844,8 @@ bool Node::is_processing_internal() const { void Node::set_process_priority(int p_priority) { data.process_priority = p_priority; + ERR_FAIL_COND(!data.tree); + if (is_processing()) data.tree->make_group_changed("idle_process"); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index dcd70a1844..8561d9aedb 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1701,6 +1701,8 @@ bool Viewport::_gui_drop(Control *p_at_control, Point2 p_at_pos, bool p_just_che void Viewport::_gui_input_event(Ref<InputEvent> p_event) { + ERR_FAIL_COND(p_event.is_null()) + //? /* if (!is_visible()) { diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 3a0144849a..a5e9351753 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -1487,8 +1487,10 @@ uint32_t CubeMap::get_flags() const { void CubeMap::set_side(Side p_side, const Ref<Image> &p_image) { + ERR_FAIL_COND(p_image.is_null()); ERR_FAIL_COND(p_image->empty()); ERR_FAIL_INDEX(p_side, 6); + if (!_is_valid()) { format = p_image->get_format(); w = p_image->get_width(); diff --git a/servers/audio/effects/audio_effect_record.cpp b/servers/audio/effects/audio_effect_record.cpp index abf9d5593c..acf27d2bbf 100644 --- a/servers/audio/effects/audio_effect_record.cpp +++ b/servers/audio/effects/audio_effect_record.cpp @@ -216,6 +216,9 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const { PoolVector<uint8_t> dst_data; + ERR_FAIL_COND_V(current_instance.is_null(), NULL); + ERR_FAIL_COND_V(current_instance->recording_data.size(), NULL); + if (dst_format == AudioStreamSample::FORMAT_8_BITS) { int data_size = current_instance->recording_data.size(); dst_data.resize(data_size); |