Merge pull request #29980 from Dentrax/directed-by-qarmin

Fix some editor crashes
This commit is contained in:
Rémi Verschelde 2019-07-01 14:59:29 +02:00 committed by GitHub
commit 6b30f284a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 23 additions and 6 deletions

View File

@ -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();

View File

@ -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());

View File

@ -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;

View File

@ -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 == "") {

View File

@ -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());

View File

@ -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();
}

View File

@ -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();

View File

@ -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");

View File

@ -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()) {

View File

@ -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();

View File

@ -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);