Skip to content

Commit 167edb3

Browse files
committed
Merge pull request godotengine#97288 from timothyqiu/packed-scene-check
Fix crash when using non-`PackedScene` resource for POT generation
2 parents 6e2cf2a + 48db666 commit 167edb3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

editor/plugins/packed_scene_translation_parser_plugin.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
#include "core/io/resource_loader.h"
3434
#include "core/object/script_language.h"
35-
#include "scene/gui/option_button.h"
3635
#include "scene/resources/packed_scene.h"
3736

3837
void PackedSceneEditorTranslationParserPlugin::get_recognized_extensions(List<String> *r_extensions) const {
@@ -49,7 +48,9 @@ Error PackedSceneEditorTranslationParserPlugin::parse_file(const String &p_path,
4948
ERR_PRINT("Failed to load " + p_path);
5049
return err;
5150
}
52-
Ref<SceneState> state = Ref<PackedScene>(loaded_res)->get_state();
51+
Ref<PackedScene> packed_scene = loaded_res;
52+
ERR_FAIL_COND_V_MSG(packed_scene.is_null(), ERR_FILE_UNRECOGNIZED, vformat("'%s' is not a valid PackedScene resource.", p_path));
53+
Ref<SceneState> state = packed_scene->get_state();
5354

5455
Vector<String> parsed_strings;
5556
Vector<Pair<NodePath, bool>> atr_owners;

0 commit comments

Comments
 (0)