summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2021-06-13 17:25:39 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2021-06-13 17:25:39 +0800
commit1a9e3edd30f6db4cb3fc7e079b64a2eb137bf865 (patch)
tree6faa04ae0f90ff6172c8a2b1d06d1850544c9831 /editor
parente866a5342826d3c3e8afe0309a311d58f3b6b4d3 (diff)
Validate parameters when adding plugins
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_plugin.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index f2502b7e70..63de06d5e2 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -717,52 +717,64 @@ void EditorPlugin::remove_undo_redo_inspector_hook_callback(Callable p_callable)
}
void EditorPlugin::add_translation_parser_plugin(const Ref<EditorTranslationParserPlugin> &p_parser) {
+ ERR_FAIL_COND(!p_parser.is_valid());
EditorTranslationParser::get_singleton()->add_parser(p_parser, EditorTranslationParser::CUSTOM);
}
void EditorPlugin::remove_translation_parser_plugin(const Ref<EditorTranslationParserPlugin> &p_parser) {
+ ERR_FAIL_COND(!p_parser.is_valid());
EditorTranslationParser::get_singleton()->remove_parser(p_parser, EditorTranslationParser::CUSTOM);
}
void EditorPlugin::add_import_plugin(const Ref<EditorImportPlugin> &p_importer) {
+ ERR_FAIL_COND(!p_importer.is_valid());
ResourceFormatImporter::get_singleton()->add_importer(p_importer);
EditorFileSystem::get_singleton()->call_deferred("scan");
}
void EditorPlugin::remove_import_plugin(const Ref<EditorImportPlugin> &p_importer) {
+ ERR_FAIL_COND(!p_importer.is_valid());
ResourceFormatImporter::get_singleton()->remove_importer(p_importer);
EditorFileSystem::get_singleton()->call_deferred("scan");
}
void EditorPlugin::add_export_plugin(const Ref<EditorExportPlugin> &p_exporter) {
+ ERR_FAIL_COND(!p_exporter.is_valid());
EditorExport::get_singleton()->add_export_plugin(p_exporter);
}
void EditorPlugin::remove_export_plugin(const Ref<EditorExportPlugin> &p_exporter) {
+ ERR_FAIL_COND(!p_exporter.is_valid());
EditorExport::get_singleton()->remove_export_plugin(p_exporter);
}
void EditorPlugin::add_spatial_gizmo_plugin(const Ref<EditorNode3DGizmoPlugin> &p_gizmo_plugin) {
+ ERR_FAIL_COND(!p_gizmo_plugin.is_valid());
Node3DEditor::get_singleton()->add_gizmo_plugin(p_gizmo_plugin);
}
void EditorPlugin::remove_spatial_gizmo_plugin(const Ref<EditorNode3DGizmoPlugin> &p_gizmo_plugin) {
+ ERR_FAIL_COND(!p_gizmo_plugin.is_valid());
Node3DEditor::get_singleton()->remove_gizmo_plugin(p_gizmo_plugin);
}
void EditorPlugin::add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin) {
+ ERR_FAIL_COND(!p_plugin.is_valid());
EditorInspector::add_inspector_plugin(p_plugin);
}
void EditorPlugin::remove_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin) {
+ ERR_FAIL_COND(!p_plugin.is_valid());
EditorInspector::remove_inspector_plugin(p_plugin);
}
void EditorPlugin::add_scene_import_plugin(const Ref<EditorSceneImporter> &p_importer) {
+ ERR_FAIL_COND(!p_importer.is_valid());
ResourceImporterScene::get_singleton()->add_importer(p_importer);
}
void EditorPlugin::remove_scene_import_plugin(const Ref<EditorSceneImporter> &p_importer) {
+ ERR_FAIL_COND(!p_importer.is_valid());
ResourceImporterScene::get_singleton()->remove_importer(p_importer);
}