summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-05-30 15:41:59 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-05-30 15:41:59 +0200
commitff242e2e94d7a009504f41fa1c102c370af254b8 (patch)
treebba3763ea260bdcc1ff5ec90ce964c54a6fd52c2
parentbe2c5e66f44df2a49a3238434c06ad33a212e544 (diff)
parentc1d5a2c8c6e55c0278da40619bf77b19f83dd886 (diff)
downloadredot-engine-ff242e2e94d7a009504f41fa1c102c370af254b8.tar.gz
Merge pull request #92539 from RandomShaper/no_crash_glsl_headless
Avoid crash when importing .glsl in headless
-rw-r--r--editor/import/resource_importer_shader_file.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/editor/import/resource_importer_shader_file.cpp b/editor/import/resource_importer_shader_file.cpp
index 6b20a8c9d5..b7508e7644 100644
--- a/editor/import/resource_importer_shader_file.cpp
+++ b/editor/import/resource_importer_shader_file.cpp
@@ -92,6 +92,7 @@ static String _include_function(const String &p_path, void *userpointer) {
Error ResourceImporterShaderFile::import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
/* STEP 1, Read shader code */
ERR_FAIL_COND_V_EDMSG((OS::get_singleton()->get_current_rendering_method() == "gl_compatibility"), ERR_UNAVAILABLE, "Cannot import custom .glsl shaders when using the gl_compatibility rendering_method. Please switch to the forward_plus or mobile rendering methods to use custom shaders.");
+ ERR_FAIL_COND_V_EDMSG((DisplayServer::get_singleton()->get_name() == "headless"), ERR_UNAVAILABLE, "Cannot import custom .glsl shaders when running in headless mode.");
Error err;
Ref<FileAccess> file = FileAccess::open(p_source_file, FileAccess::READ, &err);