Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
201d5a7f
Unverified
Commit
201d5a7f
authored
Jun 08, 2020
by
Rémi Verschelde
Committed by
GitHub
Jun 08, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #39389 from akien-mga/packedscene-root-aint-got-parents
PackedScene: Prevent crash when root node has `parent` attribute
parents
d9f0477d
c080ec5d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
editor_node.cpp
editor/editor_node.cpp
+7
-7
packed_scene.cpp
scene/resources/packed_scene.cpp
+3
-0
No files found.
editor/editor_node.cpp
View file @
201d5a7f
...
...
@@ -903,19 +903,19 @@ void EditorNode::_dialog_display_load_error(String p_file, Error p_error) {
if
(
p_error
)
{
switch
(
p_error
)
{
case
ERR_CANT_OPEN
:
{
show_accept
(
vformat
(
TTR
(
"Can't open '%s'. The file could have been moved or deleted."
),
p_file
.
get_file
()),
TTR
(
"OK"
));
show_accept
(
vformat
(
TTR
(
"Can't open
file
'%s'. The file could have been moved or deleted."
),
p_file
.
get_file
()),
TTR
(
"OK"
));
}
break
;
case
ERR_PARSE_ERROR
:
{
show_accept
(
vformat
(
TTR
(
"Error while parsing '%s'."
),
p_file
.
get_file
()),
TTR
(
"OK"
));
show_accept
(
vformat
(
TTR
(
"Error while parsing
file
'%s'."
),
p_file
.
get_file
()),
TTR
(
"OK"
));
}
break
;
case
ERR_FILE_CORRUPT
:
{
show_accept
(
vformat
(
TTR
(
"
Unexpected end of file '%s'
."
),
p_file
.
get_file
()),
TTR
(
"OK"
));
show_accept
(
vformat
(
TTR
(
"
Scene file '%s' appears to be invalid/corrupt
."
),
p_file
.
get_file
()),
TTR
(
"OK"
));
}
break
;
case
ERR_FILE_NOT_FOUND
:
{
show_accept
(
vformat
(
TTR
(
"Missing
'%s' or
its dependencies."
),
p_file
.
get_file
()),
TTR
(
"OK"
));
show_accept
(
vformat
(
TTR
(
"Missing
file '%s' or one
its dependencies."
),
p_file
.
get_file
()),
TTR
(
"OK"
));
}
break
;
default
:
{
show_accept
(
vformat
(
TTR
(
"Error while loading '%s'."
),
p_file
.
get_file
()),
TTR
(
"OK"
));
show_accept
(
vformat
(
TTR
(
"Error while loading
file
'%s'."
),
p_file
.
get_file
()),
TTR
(
"OK"
));
}
break
;
}
}
...
...
@@ -3254,13 +3254,13 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
if
(
!
new_scene
)
{
sdata
.
unref
();
_dialog_display_load_error
(
lpath
,
ERR_FILE_
NOT_FOUND
);
_dialog_display_load_error
(
lpath
,
ERR_FILE_
CORRUPT
);
opening_prev
=
false
;
if
(
prev
!=
-
1
)
{
set_current_scene
(
prev
);
editor_data
.
remove_scene
(
idx
);
}
return
ERR_FILE_
NOT_FOUND
;
return
ERR_FILE_
CORRUPT
;
}
if
(
p_set_inherited
)
{
...
...
scene/resources/packed_scene.cpp
View file @
201d5a7f
...
...
@@ -98,6 +98,9 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
}
#endif
parent
=
nparent
;
}
else
{
// i == 0 is root node. Confirm that it doesn't have a parent defined.
ERR_FAIL_COND_V_MSG
(
n
.
parent
!=
-
1
,
nullptr
,
vformat
(
"Invalid scene: root node %s cannot specify a parent node."
,
snames
[
n
.
name
]));
}
Node
*
node
=
nullptr
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment