Explorar el Código

[Drivers,Platform] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable

A Thousand Ships hace 1 año
padre
commit
3565d1bf7e
Se han modificado 33 ficheros con 425 adiciones y 425 borrados
  1. 2 2
      drivers/coreaudio/audio_driver_coreaudio.cpp
  2. 7 7
      drivers/gles3/rasterizer_canvas_gles3.cpp
  3. 1 1
      drivers/gles3/rasterizer_gles3.cpp
  4. 17 17
      drivers/gles3/rasterizer_scene_gles3.cpp
  5. 2 2
      drivers/gles3/shader_gles3.cpp
  6. 3 3
      drivers/gles3/shader_gles3.h
  7. 24 24
      drivers/gles3/storage/light_storage.cpp
  8. 9 9
      drivers/gles3/storage/light_storage.h
  9. 20 20
      drivers/gles3/storage/material_storage.cpp
  10. 45 45
      drivers/gles3/storage/mesh_storage.cpp
  11. 5 5
      drivers/gles3/storage/mesh_storage.h
  12. 50 50
      drivers/gles3/storage/particles_storage.cpp
  13. 5 5
      drivers/gles3/storage/particles_storage.h
  14. 61 61
      drivers/gles3/storage/texture_storage.cpp
  15. 3 3
      drivers/pulseaudio/audio_driver_pulseaudio.cpp
  16. 10 10
      drivers/unix/file_access_unix.cpp
  17. 2 2
      drivers/unix/os_unix.cpp
  18. 67 67
      drivers/vulkan/rendering_device_vulkan.cpp
  19. 9 9
      drivers/windows/file_access_windows.cpp
  20. 13 13
      platform/android/dir_access_jandroid.cpp
  21. 13 13
      platform/android/file_access_filesystem_jandroid.cpp
  22. 8 8
      platform/android/tts_android.cpp
  23. 1 1
      platform/ios/os_ios.mm
  24. 1 1
      platform/linuxbsd/godot_linuxbsd.cpp
  25. 5 5
      platform/linuxbsd/tts_linux.cpp
  26. 8 8
      platform/linuxbsd/x11/display_server_x11.cpp
  27. 4 4
      platform/linuxbsd/x11/gl_manager_x11.cpp
  28. 10 10
      platform/macos/display_server_macos.mm
  29. 1 1
      platform/macos/os_macos.mm
  30. 1 1
      platform/web/os_web.cpp
  31. 10 10
      platform/windows/display_server_windows.cpp
  32. 2 2
      platform/windows/os_windows.cpp
  33. 6 6
      platform/windows/tts_windows.cpp

+ 2 - 2
drivers/coreaudio/audio_driver_coreaudio.cpp

@@ -80,7 +80,7 @@ Error AudioDriverCoreAudio::init() {
 	desc.componentManufacturer = kAudioUnitManufacturer_Apple;
 
 	AudioComponent comp = AudioComponentFindNext(nullptr, &desc);
-	ERR_FAIL_COND_V(comp == nullptr, FAILED);
+	ERR_FAIL_NULL_V(comp, FAILED);
 
 	OSStatus result = AudioComponentInstanceNew(comp, &audio_unit);
 	ERR_FAIL_COND_V(result != noErr, FAILED);
@@ -349,7 +349,7 @@ Error AudioDriverCoreAudio::init_input_device() {
 	desc.componentManufacturer = kAudioUnitManufacturer_Apple;
 
 	AudioComponent comp = AudioComponentFindNext(nullptr, &desc);
-	ERR_FAIL_COND_V(comp == nullptr, FAILED);
+	ERR_FAIL_NULL_V(comp, FAILED);
 
 	OSStatus result = AudioComponentInstanceNew(comp, &input_unit);
 	ERR_FAIL_COND_V(result != noErr, FAILED);

+ 7 - 7
drivers/gles3/rasterizer_canvas_gles3.cpp

@@ -1259,7 +1259,7 @@ void RasterizerCanvasGLES3::_render_batch(Light *p_lights, uint32_t p_index) {
 			const Item::CommandPolygon *polygon = static_cast<const Item::CommandPolygon *>(state.canvas_instance_batches[p_index].command);
 
 			PolygonBuffers *pb = polygon_buffers.polygons.getptr(polygon->polygon.polygon_id);
-			ERR_FAIL_COND(!pb);
+			ERR_FAIL_NULL(pb);
 
 			glBindVertexArray(pb->vertex_array);
 			glBindBuffer(GL_ARRAY_BUFFER, state.canvas_instance_data_buffers[state.current_data_buffer_index].instance_buffers[state.canvas_instance_batches[p_index].instance_buffer_index]);
@@ -1515,7 +1515,7 @@ void RasterizerCanvasGLES3::light_set_texture(RID p_rid, RID p_texture) {
 	GLES3::TextureStorage *texture_storage = GLES3::TextureStorage::get_singleton();
 
 	CanvasLight *cl = canvas_light_owner.get_or_null(p_rid);
-	ERR_FAIL_COND(!cl);
+	ERR_FAIL_NULL(cl);
 	if (cl->texture == p_texture) {
 		return;
 	}
@@ -1534,7 +1534,7 @@ void RasterizerCanvasGLES3::light_set_texture(RID p_rid, RID p_texture) {
 
 void RasterizerCanvasGLES3::light_set_use_shadow(RID p_rid, bool p_enable) {
 	CanvasLight *cl = canvas_light_owner.get_or_null(p_rid);
-	ERR_FAIL_COND(!cl);
+	ERR_FAIL_NULL(cl);
 
 	cl->shadow.enabled = p_enable;
 }
@@ -1868,7 +1868,7 @@ RID RasterizerCanvasGLES3::occluder_polygon_create() {
 
 void RasterizerCanvasGLES3::occluder_polygon_set_shape(RID p_occluder, const Vector<Vector2> &p_points, bool p_closed) {
 	OccluderPolygon *oc = occluder_polygon_owner.get_or_null(p_occluder);
-	ERR_FAIL_COND(!oc);
+	ERR_FAIL_NULL(oc);
 
 	Vector<Vector2> lines;
 
@@ -2041,7 +2041,7 @@ void RasterizerCanvasGLES3::occluder_polygon_set_shape(RID p_occluder, const Vec
 
 void RasterizerCanvasGLES3::occluder_polygon_set_cull_mode(RID p_occluder, RS::CanvasOccluderPolygonCullMode p_mode) {
 	OccluderPolygon *oc = occluder_polygon_owner.get_or_null(p_occluder);
-	ERR_FAIL_COND(!oc);
+	ERR_FAIL_NULL(oc);
 	oc->cull_mode = p_mode;
 }
 
@@ -2073,7 +2073,7 @@ void RasterizerCanvasGLES3::set_shadow_texture_size(int p_size) {
 bool RasterizerCanvasGLES3::free(RID p_rid) {
 	if (canvas_light_owner.owns(p_rid)) {
 		CanvasLight *cl = canvas_light_owner.get_or_null(p_rid);
-		ERR_FAIL_COND_V(!cl, false);
+		ERR_FAIL_NULL_V(cl, false);
 		canvas_light_owner.free(p_rid);
 	} else if (occluder_polygon_owner.owns(p_rid)) {
 		occluder_polygon_set_shape(p_rid, Vector<Vector2>(), false);
@@ -2455,7 +2455,7 @@ RendererCanvasRender::PolygonID RasterizerCanvasGLES3::request_polygon(const Vec
 
 void RasterizerCanvasGLES3::free_polygon(PolygonID p_polygon) {
 	PolygonBuffers *pb_ptr = polygon_buffers.polygons.getptr(p_polygon);
-	ERR_FAIL_COND(!pb_ptr);
+	ERR_FAIL_NULL(pb_ptr);
 
 	PolygonBuffers &pb = *pb_ptr;
 

+ 1 - 1
drivers/gles3/rasterizer_gles3.cpp

@@ -318,7 +318,7 @@ void RasterizerGLES3::prepare_for_blitting_render_targets() {
 void RasterizerGLES3::_blit_render_target_to_screen(RID p_render_target, DisplayServer::WindowID p_screen, const Rect2 &p_screen_rect, uint32_t p_layer, bool p_first) {
 	GLES3::RenderTarget *rt = GLES3::TextureStorage::get_singleton()->get_render_target(p_render_target);
 
-	ERR_FAIL_COND(!rt);
+	ERR_FAIL_NULL(rt);
 
 	// We normally render to the render target upside down, so flip Y when blitting to the screen.
 	bool flip_y = true;

+ 17 - 17
drivers/gles3/rasterizer_scene_gles3.cpp

@@ -95,7 +95,7 @@ void RasterizerSceneGLES3::GeometryInstanceGLES3::pair_light_instances(const RID
 
 void RasterizerSceneGLES3::geometry_instance_free(RenderGeometryInstance *p_geometry_instance) {
 	GeometryInstanceGLES3 *ginstance = static_cast<GeometryInstanceGLES3 *>(p_geometry_instance);
-	ERR_FAIL_COND(!ginstance);
+	ERR_FAIL_NULL(ginstance);
 	GeometryInstanceSurface *surf = ginstance->surface_caches;
 	while (surf) {
 		GeometryInstanceSurface *next = surf->next;
@@ -300,7 +300,7 @@ void RasterizerSceneGLES3::_geometry_instance_add_surface(GeometryInstanceGLES3
 		m_src = scene_globals.default_material;
 	}
 
-	ERR_FAIL_COND(!material_data);
+	ERR_FAIL_NULL(material_data);
 
 	_geometry_instance_add_surface_with_material_chain(ginstance, p_surface, material_data, m_src, p_mesh);
 
@@ -462,7 +462,7 @@ void RasterizerSceneGLES3::sky_initialize(RID p_rid) {
 
 void RasterizerSceneGLES3::sky_set_radiance_size(RID p_sky, int p_radiance_size) {
 	Sky *sky = sky_owner.get_or_null(p_sky);
-	ERR_FAIL_COND(!sky);
+	ERR_FAIL_NULL(sky);
 	ERR_FAIL_COND_MSG(p_radiance_size < 32 || p_radiance_size > 2048, "Sky radiance size must be between 32 and 2048");
 
 	if (sky->radiance_size == p_radiance_size) {
@@ -477,7 +477,7 @@ void RasterizerSceneGLES3::sky_set_radiance_size(RID p_sky, int p_radiance_size)
 
 void RasterizerSceneGLES3::sky_set_mode(RID p_sky, RS::SkyMode p_mode) {
 	Sky *sky = sky_owner.get_or_null(p_sky);
-	ERR_FAIL_COND(!sky);
+	ERR_FAIL_NULL(sky);
 
 	if (sky->mode == p_mode) {
 		return;
@@ -489,7 +489,7 @@ void RasterizerSceneGLES3::sky_set_mode(RID p_sky, RS::SkyMode p_mode) {
 
 void RasterizerSceneGLES3::sky_set_material(RID p_sky, RID p_material) {
 	Sky *sky = sky_owner.get_or_null(p_sky);
-	ERR_FAIL_COND(!sky);
+	ERR_FAIL_NULL(sky);
 
 	if (sky->material == p_material) {
 		return;
@@ -501,7 +501,7 @@ void RasterizerSceneGLES3::sky_set_material(RID p_sky, RID p_material) {
 
 float RasterizerSceneGLES3::sky_get_baked_exposure(RID p_sky) const {
 	Sky *sky = sky_owner.get_or_null(p_sky);
-	ERR_FAIL_COND_V(!sky, 1.0);
+	ERR_FAIL_NULL_V(sky, 1.0);
 
 	return sky->baked_exposure;
 }
@@ -615,11 +615,11 @@ void RasterizerSceneGLES3::_setup_sky(const RenderDataGLES3 *p_render_data, cons
 		material = static_cast<GLES3::SkyMaterialData *>(material_storage->material_get_data(sky_material, RS::SHADER_SKY));
 	}
 
-	ERR_FAIL_COND(!material);
+	ERR_FAIL_NULL(material);
 
 	shader_data = material->shader_data;
 
-	ERR_FAIL_COND(!shader_data);
+	ERR_FAIL_NULL(shader_data);
 
 	if (sky) {
 		if (shader_data->uses_time && time - sky->prev_time > 0.00001) {
@@ -757,7 +757,7 @@ void RasterizerSceneGLES3::_draw_sky(RID p_env, const Projection &p_projection,
 	ERR_FAIL_COND(p_env.is_null());
 
 	Sky *sky = sky_owner.get_or_null(environment_get_sky(p_env));
-	ERR_FAIL_COND(!sky);
+	ERR_FAIL_NULL(sky);
 
 	GLES3::SkyMaterialData *material_data = nullptr;
 	RID sky_material;
@@ -788,12 +788,12 @@ void RasterizerSceneGLES3::_draw_sky(RID p_env, const Projection &p_projection,
 		material_data = static_cast<GLES3::SkyMaterialData *>(material_storage->material_get_data(sky_material, RS::SHADER_SKY));
 	}
 
-	ERR_FAIL_COND(!material_data);
+	ERR_FAIL_NULL(material_data);
 	material_data->bind_uniforms();
 
 	GLES3::SkyShaderData *shader_data = material_data->shader_data;
 
-	ERR_FAIL_COND(!shader_data);
+	ERR_FAIL_NULL(shader_data);
 
 	// Camera
 	Projection camera;
@@ -836,7 +836,7 @@ void RasterizerSceneGLES3::_update_sky_radiance(RID p_env, const Projection &p_p
 	ERR_FAIL_COND(p_env.is_null());
 
 	Sky *sky = sky_owner.get_or_null(environment_get_sky(p_env));
-	ERR_FAIL_COND(!sky);
+	ERR_FAIL_NULL(sky);
 
 	GLES3::SkyMaterialData *material_data = nullptr;
 	RID sky_material;
@@ -844,7 +844,7 @@ void RasterizerSceneGLES3::_update_sky_radiance(RID p_env, const Projection &p_p
 	RS::EnvironmentBG background = environment_get_background(p_env);
 
 	if (sky) {
-		ERR_FAIL_COND(!sky);
+		ERR_FAIL_NULL(sky);
 		sky_material = sky->material;
 
 		if (sky_material.is_valid()) {
@@ -863,12 +863,12 @@ void RasterizerSceneGLES3::_update_sky_radiance(RID p_env, const Projection &p_p
 		material_data = static_cast<GLES3::SkyMaterialData *>(material_storage->material_get_data(sky_material, RS::SHADER_SKY));
 	}
 
-	ERR_FAIL_COND(!material_data);
+	ERR_FAIL_NULL(material_data);
 	material_data->bind_uniforms();
 
 	GLES3::SkyShaderData *shader_data = material_data->shader_data;
 
-	ERR_FAIL_COND(!shader_data);
+	ERR_FAIL_NULL(shader_data);
 
 	bool update_single_frame = sky->mode == RS::SKY_MODE_REALTIME || sky->mode == RS::SKY_MODE_QUALITY;
 	RS::SkyMode sky_mode = sky->mode;
@@ -1731,7 +1731,7 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_
 	}
 
 	GLES3::RenderTarget *rt = texture_storage->get_render_target(rb->render_target);
-	ERR_FAIL_COND(!rt);
+	ERR_FAIL_NULL(rt);
 
 	// Assign render data
 	// Use the format from rendererRD
@@ -2584,7 +2584,7 @@ bool RasterizerSceneGLES3::free(RID p_rid) {
 		environment_free(p_rid);
 	} else if (sky_owner.owns(p_rid)) {
 		Sky *sky = sky_owner.get_or_null(p_rid);
-		ERR_FAIL_COND_V(!sky, false);
+		ERR_FAIL_NULL_V(sky, false);
 		_free_sky_data(sky);
 		sky_owner.free(p_rid);
 	} else if (GLES3::LightStorage::get_singleton()->owns_light_instance(p_rid)) {

+ 2 - 2
drivers/gles3/shader_gles3.cpp

@@ -452,7 +452,7 @@ void ShaderGLES3::_compile_specialization(Version::Specialization &spec, uint32_
 RS::ShaderNativeSourceCode ShaderGLES3::version_get_native_source_code(RID p_version) {
 	Version *version = version_owner.get_or_null(p_version);
 	RS::ShaderNativeSourceCode source_code;
-	ERR_FAIL_COND_V(!version, source_code);
+	ERR_FAIL_NULL_V(version, source_code);
 
 	source_code.versions.resize(variant_count);
 
@@ -685,7 +685,7 @@ void ShaderGLES3::_initialize_version(Version *p_version) {
 
 void ShaderGLES3::version_set_code(RID p_version, const HashMap<String, String> &p_code, const String &p_uniforms, const String &p_vertex_globals, const String &p_fragment_globals, const Vector<String> &p_custom_defines, const LocalVector<ShaderGLES3::TextureUniformData> &p_texture_uniforms, bool p_initialize) {
 	Version *version = version_owner.get_or_null(p_version);
-	ERR_FAIL_COND(!version);
+	ERR_FAIL_NULL(version);
 
 	_clear_version(version); //clear if existing
 

+ 3 - 3
drivers/gles3/shader_gles3.h

@@ -197,7 +197,7 @@ protected:
 		ERR_FAIL_INDEX_V(p_variant, variant_count, false);
 
 		Version *version = version_owner.get_or_null(p_version);
-		ERR_FAIL_COND_V(!version, false);
+		ERR_FAIL_NULL_V(version, false);
 
 		if (version->variants.size() == 0) {
 			_initialize_version(version); //may lack initialization
@@ -235,10 +235,10 @@ protected:
 	_FORCE_INLINE_ int _version_get_uniform(int p_which, RID p_version, int p_variant, uint64_t p_specialization) {
 		ERR_FAIL_INDEX_V(p_which, uniform_count, -1);
 		Version *version = version_owner.get_or_null(p_version);
-		ERR_FAIL_COND_V(!version, -1);
+		ERR_FAIL_NULL_V(version, -1);
 		ERR_FAIL_INDEX_V(p_variant, int(version->variants.size()), -1);
 		Version::Specialization *spec = version->variants[p_variant].lookup_ptr(p_specialization);
-		ERR_FAIL_COND_V(!spec, -1);
+		ERR_FAIL_NULL_V(spec, -1);
 		ERR_FAIL_INDEX_V(p_which, int(spec->uniform_location.size()), -1);
 		return spec->uniform_location[p_which];
 	}

+ 24 - 24
drivers/gles3/storage/light_storage.cpp

@@ -116,14 +116,14 @@ void LightStorage::light_free(RID p_rid) {
 
 void LightStorage::light_set_color(RID p_light, const Color &p_color) {
 	Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND(!light);
+	ERR_FAIL_NULL(light);
 
 	light->color = p_color;
 }
 
 void LightStorage::light_set_param(RID p_light, RS::LightParam p_param, float p_value) {
 	Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND(!light);
+	ERR_FAIL_NULL(light);
 	ERR_FAIL_INDEX(p_param, RS::LIGHT_PARAM_MAX);
 
 	if (light->param[p_param] == p_value) {
@@ -158,7 +158,7 @@ void LightStorage::light_set_param(RID p_light, RS::LightParam p_param, float p_
 
 void LightStorage::light_set_shadow(RID p_light, bool p_enabled) {
 	Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND(!light);
+	ERR_FAIL_NULL(light);
 	light->shadow = p_enabled;
 
 	light->version++;
@@ -168,7 +168,7 @@ void LightStorage::light_set_shadow(RID p_light, bool p_enabled) {
 void LightStorage::light_set_projector(RID p_light, RID p_texture) {
 	GLES3::TextureStorage *texture_storage = GLES3::TextureStorage::get_singleton();
 	Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND(!light);
+	ERR_FAIL_NULL(light);
 
 	if (light->projector == p_texture) {
 		return;
@@ -190,14 +190,14 @@ void LightStorage::light_set_projector(RID p_light, RID p_texture) {
 
 void LightStorage::light_set_negative(RID p_light, bool p_enable) {
 	Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND(!light);
+	ERR_FAIL_NULL(light);
 
 	light->negative = p_enable;
 }
 
 void LightStorage::light_set_cull_mask(RID p_light, uint32_t p_mask) {
 	Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND(!light);
+	ERR_FAIL_NULL(light);
 
 	light->cull_mask = p_mask;
 
@@ -207,7 +207,7 @@ void LightStorage::light_set_cull_mask(RID p_light, uint32_t p_mask) {
 
 void LightStorage::light_set_distance_fade(RID p_light, bool p_enabled, float p_begin, float p_shadow, float p_length) {
 	Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND(!light);
+	ERR_FAIL_NULL(light);
 
 	light->distance_fade = p_enabled;
 	light->distance_fade_begin = p_begin;
@@ -217,7 +217,7 @@ void LightStorage::light_set_distance_fade(RID p_light, bool p_enabled, float p_
 
 void LightStorage::light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) {
 	Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND(!light);
+	ERR_FAIL_NULL(light);
 
 	light->reverse_cull = p_enabled;
 
@@ -227,7 +227,7 @@ void LightStorage::light_set_reverse_cull_face_mode(RID p_light, bool p_enabled)
 
 void LightStorage::light_set_bake_mode(RID p_light, RS::LightBakeMode p_bake_mode) {
 	Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND(!light);
+	ERR_FAIL_NULL(light);
 
 	light->bake_mode = p_bake_mode;
 
@@ -237,7 +237,7 @@ void LightStorage::light_set_bake_mode(RID p_light, RS::LightBakeMode p_bake_mod
 
 void LightStorage::light_omni_set_shadow_mode(RID p_light, RS::LightOmniShadowMode p_mode) {
 	Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND(!light);
+	ERR_FAIL_NULL(light);
 
 	light->omni_shadow_mode = p_mode;
 
@@ -247,14 +247,14 @@ void LightStorage::light_omni_set_shadow_mode(RID p_light, RS::LightOmniShadowMo
 
 RS::LightOmniShadowMode LightStorage::light_omni_get_shadow_mode(RID p_light) {
 	const Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND_V(!light, RS::LIGHT_OMNI_SHADOW_CUBE);
+	ERR_FAIL_NULL_V(light, RS::LIGHT_OMNI_SHADOW_CUBE);
 
 	return light->omni_shadow_mode;
 }
 
 void LightStorage::light_directional_set_shadow_mode(RID p_light, RS::LightDirectionalShadowMode p_mode) {
 	Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND(!light);
+	ERR_FAIL_NULL(light);
 
 	light->directional_shadow_mode = p_mode;
 	light->version++;
@@ -263,7 +263,7 @@ void LightStorage::light_directional_set_shadow_mode(RID p_light, RS::LightDirec
 
 void LightStorage::light_directional_set_blend_splits(RID p_light, bool p_enable) {
 	Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND(!light);
+	ERR_FAIL_NULL(light);
 
 	light->directional_blend_splits = p_enable;
 	light->version++;
@@ -272,56 +272,56 @@ void LightStorage::light_directional_set_blend_splits(RID p_light, bool p_enable
 
 bool LightStorage::light_directional_get_blend_splits(RID p_light) const {
 	const Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND_V(!light, false);
+	ERR_FAIL_NULL_V(light, false);
 
 	return light->directional_blend_splits;
 }
 
 void LightStorage::light_directional_set_sky_mode(RID p_light, RS::LightDirectionalSkyMode p_mode) {
 	Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND(!light);
+	ERR_FAIL_NULL(light);
 
 	light->directional_sky_mode = p_mode;
 }
 
 RS::LightDirectionalSkyMode LightStorage::light_directional_get_sky_mode(RID p_light) const {
 	const Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND_V(!light, RS::LIGHT_DIRECTIONAL_SKY_MODE_LIGHT_AND_SKY);
+	ERR_FAIL_NULL_V(light, RS::LIGHT_DIRECTIONAL_SKY_MODE_LIGHT_AND_SKY);
 
 	return light->directional_sky_mode;
 }
 
 RS::LightDirectionalShadowMode LightStorage::light_directional_get_shadow_mode(RID p_light) {
 	const Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND_V(!light, RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL);
+	ERR_FAIL_NULL_V(light, RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL);
 
 	return light->directional_shadow_mode;
 }
 
 RS::LightBakeMode LightStorage::light_get_bake_mode(RID p_light) {
 	const Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND_V(!light, RS::LIGHT_BAKE_DISABLED);
+	ERR_FAIL_NULL_V(light, RS::LIGHT_BAKE_DISABLED);
 
 	return light->bake_mode;
 }
 
 uint64_t LightStorage::light_get_version(RID p_light) const {
 	const Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND_V(!light, 0);
+	ERR_FAIL_NULL_V(light, 0);
 
 	return light->version;
 }
 
 uint32_t LightStorage::light_get_cull_mask(RID p_light) const {
 	const Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND_V(!light, 0);
+	ERR_FAIL_NULL_V(light, 0);
 
 	return light->cull_mask;
 }
 
 AABB LightStorage::light_get_aabb(RID p_light) const {
 	const Light *light = light_owner.get_or_null(p_light);
-	ERR_FAIL_COND_V(!light, AABB());
+	ERR_FAIL_NULL_V(light, AABB());
 
 	switch (light->type) {
 		case RS::LIGHT_SPOT: {
@@ -357,20 +357,20 @@ RID LightStorage::light_instance_create(RID p_light) {
 
 void LightStorage::light_instance_free(RID p_light_instance) {
 	LightInstance *light_instance = light_instance_owner.get_or_null(p_light_instance);
-	ERR_FAIL_COND(!light_instance);
+	ERR_FAIL_NULL(light_instance);
 	light_instance_owner.free(p_light_instance);
 }
 
 void LightStorage::light_instance_set_transform(RID p_light_instance, const Transform3D &p_transform) {
 	LightInstance *light_instance = light_instance_owner.get_or_null(p_light_instance);
-	ERR_FAIL_COND(!light_instance);
+	ERR_FAIL_NULL(light_instance);
 
 	light_instance->transform = p_transform;
 }
 
 void LightStorage::light_instance_set_aabb(RID p_light_instance, const AABB &p_aabb) {
 	LightInstance *light_instance = light_instance_owner.get_or_null(p_light_instance);
-	ERR_FAIL_COND(!light_instance);
+	ERR_FAIL_NULL(light_instance);
 
 	light_instance->aabb = p_aabb;
 }

+ 9 - 9
drivers/gles3/storage/light_storage.h

@@ -212,7 +212,7 @@ public:
 	virtual RS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light) override;
 	virtual RS::LightType light_get_type(RID p_light) const override {
 		const Light *light = light_owner.get_or_null(p_light);
-		ERR_FAIL_COND_V(!light, RS::LIGHT_DIRECTIONAL);
+		ERR_FAIL_NULL_V(light, RS::LIGHT_DIRECTIONAL);
 
 		return light->type;
 	}
@@ -220,21 +220,21 @@ public:
 
 	virtual float light_get_param(RID p_light, RS::LightParam p_param) override {
 		const Light *light = light_owner.get_or_null(p_light);
-		ERR_FAIL_COND_V(!light, 0);
+		ERR_FAIL_NULL_V(light, 0);
 
 		return light->param[p_param];
 	}
 
 	_FORCE_INLINE_ RID light_get_projector(RID p_light) {
 		const Light *light = light_owner.get_or_null(p_light);
-		ERR_FAIL_COND_V(!light, RID());
+		ERR_FAIL_NULL_V(light, RID());
 
 		return light->projector;
 	}
 
 	virtual Color light_get_color(RID p_light) override {
 		const Light *light = light_owner.get_or_null(p_light);
-		ERR_FAIL_COND_V(!light, Color());
+		ERR_FAIL_NULL_V(light, Color());
 
 		return light->color;
 	}
@@ -261,35 +261,35 @@ public:
 
 	virtual bool light_has_shadow(RID p_light) const override {
 		const Light *light = light_owner.get_or_null(p_light);
-		ERR_FAIL_COND_V(!light, RS::LIGHT_DIRECTIONAL);
+		ERR_FAIL_NULL_V(light, RS::LIGHT_DIRECTIONAL);
 
 		return light->shadow;
 	}
 
 	virtual bool light_has_projector(RID p_light) const override {
 		const Light *light = light_owner.get_or_null(p_light);
-		ERR_FAIL_COND_V(!light, RS::LIGHT_DIRECTIONAL);
+		ERR_FAIL_NULL_V(light, RS::LIGHT_DIRECTIONAL);
 
 		return TextureStorage::get_singleton()->owns_texture(light->projector);
 	}
 
 	_FORCE_INLINE_ bool light_is_negative(RID p_light) const {
 		const Light *light = light_owner.get_or_null(p_light);
-		ERR_FAIL_COND_V(!light, RS::LIGHT_DIRECTIONAL);
+		ERR_FAIL_NULL_V(light, RS::LIGHT_DIRECTIONAL);
 
 		return light->negative;
 	}
 
 	_FORCE_INLINE_ float light_get_transmittance_bias(RID p_light) const {
 		const Light *light = light_owner.get_or_null(p_light);
-		ERR_FAIL_COND_V(!light, 0.0);
+		ERR_FAIL_NULL_V(light, 0.0);
 
 		return light->param[RS::LIGHT_PARAM_TRANSMITTANCE_BIAS];
 	}
 
 	virtual bool light_get_reverse_cull_face_mode(RID p_light) const override {
 		const Light *light = light_owner.get_or_null(p_light);
-		ERR_FAIL_COND_V(!light, false);
+		ERR_FAIL_NULL_V(light, false);
 
 		return light->reverse_cull;
 	}

+ 20 - 20
drivers/gles3/storage/material_storage.cpp

@@ -2137,7 +2137,7 @@ void MaterialStorage::shader_initialize(RID p_rid) {
 
 void MaterialStorage::shader_free(RID p_rid) {
 	GLES3::Shader *shader = shader_owner.get_or_null(p_rid);
-	ERR_FAIL_COND(!shader);
+	ERR_FAIL_NULL(shader);
 
 	//make material unreference this
 	while (shader->owners.size()) {
@@ -2153,7 +2153,7 @@ void MaterialStorage::shader_free(RID p_rid) {
 
 void MaterialStorage::shader_set_code(RID p_shader, const String &p_code) {
 	GLES3::Shader *shader = shader_owner.get_or_null(p_shader);
-	ERR_FAIL_COND(!shader);
+	ERR_FAIL_NULL(shader);
 
 	shader->code = p_code;
 
@@ -2231,7 +2231,7 @@ void MaterialStorage::shader_set_code(RID p_shader, const String &p_code) {
 
 void MaterialStorage::shader_set_path_hint(RID p_shader, const String &p_path) {
 	GLES3::Shader *shader = shader_owner.get_or_null(p_shader);
-	ERR_FAIL_COND(!shader);
+	ERR_FAIL_NULL(shader);
 
 	shader->path_hint = p_path;
 	if (shader->data) {
@@ -2241,13 +2241,13 @@ void MaterialStorage::shader_set_path_hint(RID p_shader, const String &p_path) {
 
 String MaterialStorage::shader_get_code(RID p_shader) const {
 	const GLES3::Shader *shader = shader_owner.get_or_null(p_shader);
-	ERR_FAIL_COND_V(!shader, String());
+	ERR_FAIL_NULL_V(shader, String());
 	return shader->code;
 }
 
 void MaterialStorage::get_shader_parameter_list(RID p_shader, List<PropertyInfo> *p_param_list) const {
 	GLES3::Shader *shader = shader_owner.get_or_null(p_shader);
-	ERR_FAIL_COND(!shader);
+	ERR_FAIL_NULL(shader);
 	if (shader->data) {
 		return shader->data->get_shader_uniform_list(p_param_list);
 	}
@@ -2255,7 +2255,7 @@ void MaterialStorage::get_shader_parameter_list(RID p_shader, List<PropertyInfo>
 
 void MaterialStorage::shader_set_default_texture_parameter(RID p_shader, const StringName &p_name, RID p_texture, int p_index) {
 	GLES3::Shader *shader = shader_owner.get_or_null(p_shader);
-	ERR_FAIL_COND(!shader);
+	ERR_FAIL_NULL(shader);
 
 	if (p_texture.is_valid() && TextureStorage::get_singleton()->owns_texture(p_texture)) {
 		if (!shader->default_texture_parameter.has(p_name)) {
@@ -2282,7 +2282,7 @@ void MaterialStorage::shader_set_default_texture_parameter(RID p_shader, const S
 
 RID MaterialStorage::shader_get_default_texture_parameter(RID p_shader, const StringName &p_name, int p_index) const {
 	const GLES3::Shader *shader = shader_owner.get_or_null(p_shader);
-	ERR_FAIL_COND_V(!shader, RID());
+	ERR_FAIL_NULL_V(shader, RID());
 	if (shader->default_texture_parameter.has(p_name) && shader->default_texture_parameter[p_name].has(p_index)) {
 		return shader->default_texture_parameter[p_name][p_index];
 	}
@@ -2292,7 +2292,7 @@ RID MaterialStorage::shader_get_default_texture_parameter(RID p_shader, const St
 
 Variant MaterialStorage::shader_get_parameter_default(RID p_shader, const StringName &p_param) const {
 	Shader *shader = shader_owner.get_or_null(p_shader);
-	ERR_FAIL_COND_V(!shader, Variant());
+	ERR_FAIL_NULL_V(shader, Variant());
 	if (shader->data) {
 		return shader->data->get_default_parameter(p_param);
 	}
@@ -2301,7 +2301,7 @@ Variant MaterialStorage::shader_get_parameter_default(RID p_shader, const String
 
 RS::ShaderNativeSourceCode MaterialStorage::shader_get_native_source_code(RID p_shader) const {
 	Shader *shader = shader_owner.get_or_null(p_shader);
-	ERR_FAIL_COND_V(!shader, RS::ShaderNativeSourceCode());
+	ERR_FAIL_NULL_V(shader, RS::ShaderNativeSourceCode());
 	if (shader->data) {
 		return shader->data->get_native_source_code();
 	}
@@ -2347,7 +2347,7 @@ void MaterialStorage::material_initialize(RID p_rid) {
 
 void MaterialStorage::material_free(RID p_rid) {
 	Material *material = material_owner.get_or_null(p_rid);
-	ERR_FAIL_COND(!material);
+	ERR_FAIL_NULL(material);
 
 	// Need to clear texture arrays to prevent spin locking of their RID's.
 	// This happens when the app is being closed.
@@ -2365,7 +2365,7 @@ void MaterialStorage::material_free(RID p_rid) {
 
 void MaterialStorage::material_set_shader(RID p_material, RID p_shader) {
 	GLES3::Material *material = material_owner.get_or_null(p_material);
-	ERR_FAIL_COND(!material);
+	ERR_FAIL_NULL(material);
 
 	if (material->data) {
 		memdelete(material->data);
@@ -2385,7 +2385,7 @@ void MaterialStorage::material_set_shader(RID p_material, RID p_shader) {
 	}
 
 	Shader *shader = get_shader(p_shader);
-	ERR_FAIL_COND(!shader);
+	ERR_FAIL_NULL(shader);
 	material->shader = shader;
 	material->shader_mode = shader->mode;
 	material->shader_id = p_shader.get_local_index();
@@ -2408,7 +2408,7 @@ void MaterialStorage::material_set_shader(RID p_material, RID p_shader) {
 
 void MaterialStorage::material_set_param(RID p_material, const StringName &p_param, const Variant &p_value) {
 	GLES3::Material *material = material_owner.get_or_null(p_material);
-	ERR_FAIL_COND(!material);
+	ERR_FAIL_NULL(material);
 
 	if (p_value.get_type() == Variant::NIL) {
 		material->params.erase(p_param);
@@ -2427,7 +2427,7 @@ void MaterialStorage::material_set_param(RID p_material, const StringName &p_par
 
 Variant MaterialStorage::material_get_param(RID p_material, const StringName &p_param) const {
 	const GLES3::Material *material = material_owner.get_or_null(p_material);
-	ERR_FAIL_COND_V(!material, Variant());
+	ERR_FAIL_NULL_V(material, Variant());
 	if (material->params.has(p_param)) {
 		return material->params[p_param];
 	} else {
@@ -2437,7 +2437,7 @@ Variant MaterialStorage::material_get_param(RID p_material, const StringName &p_
 
 void MaterialStorage::material_set_next_pass(RID p_material, RID p_next_material) {
 	GLES3::Material *material = material_owner.get_or_null(p_material);
-	ERR_FAIL_COND(!material);
+	ERR_FAIL_NULL(material);
 
 	if (material->next_pass == p_next_material) {
 		return;
@@ -2456,7 +2456,7 @@ void MaterialStorage::material_set_render_priority(RID p_material, int priority)
 	ERR_FAIL_COND(priority > RS::MATERIAL_RENDER_PRIORITY_MAX);
 
 	GLES3::Material *material = material_owner.get_or_null(p_material);
-	ERR_FAIL_COND(!material);
+	ERR_FAIL_NULL(material);
 	material->priority = priority;
 	if (material->data) {
 		material->data->set_render_priority(priority);
@@ -2466,7 +2466,7 @@ void MaterialStorage::material_set_render_priority(RID p_material, int priority)
 
 bool MaterialStorage::material_is_animated(RID p_material) {
 	GLES3::Material *material = material_owner.get_or_null(p_material);
-	ERR_FAIL_COND_V(!material, false);
+	ERR_FAIL_NULL_V(material, false);
 	if (material->shader && material->shader->data) {
 		if (material->shader->data->is_animated()) {
 			return true;
@@ -2479,7 +2479,7 @@ bool MaterialStorage::material_is_animated(RID p_material) {
 
 bool MaterialStorage::material_casts_shadows(RID p_material) {
 	GLES3::Material *material = material_owner.get_or_null(p_material);
-	ERR_FAIL_COND_V(!material, true);
+	ERR_FAIL_NULL_V(material, true);
 	if (material->shader && material->shader->data) {
 		if (material->shader->data->casts_shadows()) {
 			return true;
@@ -2492,7 +2492,7 @@ bool MaterialStorage::material_casts_shadows(RID p_material) {
 
 void MaterialStorage::material_get_instance_shader_parameters(RID p_material, List<InstanceShaderParam> *r_parameters) {
 	GLES3::Material *material = material_owner.get_or_null(p_material);
-	ERR_FAIL_COND(!material);
+	ERR_FAIL_NULL(material);
 	if (material->shader && material->shader->data) {
 		material->shader->data->get_instance_param_list(r_parameters);
 
@@ -2504,7 +2504,7 @@ void MaterialStorage::material_get_instance_shader_parameters(RID p_material, Li
 
 void MaterialStorage::material_update_dependency(RID p_material, DependencyTracker *p_instance) {
 	Material *material = material_owner.get_or_null(p_material);
-	ERR_FAIL_COND(!material);
+	ERR_FAIL_NULL(material);
 	p_instance->update_dependency(&material->dependency);
 	if (material->next_pass.is_valid()) {
 		material_update_dependency(material->next_pass, p_instance);

+ 45 - 45
drivers/gles3/storage/mesh_storage.cpp

@@ -70,7 +70,7 @@ void MeshStorage::mesh_free(RID p_rid) {
 	mesh_clear(p_rid);
 	mesh_set_shadow_mesh(p_rid, RID());
 	Mesh *mesh = mesh_owner.get_or_null(p_rid);
-	ERR_FAIL_COND(!mesh);
+	ERR_FAIL_NULL(mesh);
 
 	mesh->dependency.deleted_notify(p_rid);
 	if (mesh->instances.size()) {
@@ -90,7 +90,7 @@ void MeshStorage::mesh_set_blend_shape_count(RID p_mesh, int p_blend_shape_count
 	ERR_FAIL_COND(p_blend_shape_count < 0);
 
 	Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-	ERR_FAIL_COND(!mesh);
+	ERR_FAIL_NULL(mesh);
 
 	ERR_FAIL_COND(mesh->surface_count > 0); //surfaces already exist
 	mesh->blend_shape_count = p_blend_shape_count;
@@ -98,14 +98,14 @@ void MeshStorage::mesh_set_blend_shape_count(RID p_mesh, int p_blend_shape_count
 
 bool MeshStorage::mesh_needs_instance(RID p_mesh, bool p_has_skeleton) {
 	Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-	ERR_FAIL_COND_V(!mesh, false);
+	ERR_FAIL_NULL_V(mesh, false);
 
 	return mesh->blend_shape_count > 0 || (mesh->has_bone_weights && p_has_skeleton);
 }
 
 void MeshStorage::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface) {
 	Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-	ERR_FAIL_COND(!mesh);
+	ERR_FAIL_NULL(mesh);
 
 	ERR_FAIL_COND(mesh->surface_count == RS::MAX_MESH_SURFACES);
 
@@ -352,13 +352,13 @@ void MeshStorage::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface)
 
 int MeshStorage::mesh_get_blend_shape_count(RID p_mesh) const {
 	const Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-	ERR_FAIL_COND_V(!mesh, -1);
+	ERR_FAIL_NULL_V(mesh, -1);
 	return mesh->blend_shape_count;
 }
 
 void MeshStorage::mesh_set_blend_shape_mode(RID p_mesh, RS::BlendShapeMode p_mode) {
 	Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-	ERR_FAIL_COND(!mesh);
+	ERR_FAIL_NULL(mesh);
 	ERR_FAIL_INDEX((int)p_mode, 2);
 
 	mesh->blend_shape_mode = p_mode;
@@ -366,13 +366,13 @@ void MeshStorage::mesh_set_blend_shape_mode(RID p_mesh, RS::BlendShapeMode p_mod
 
 RS::BlendShapeMode MeshStorage::mesh_get_blend_shape_mode(RID p_mesh) const {
 	Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-	ERR_FAIL_COND_V(!mesh, RS::BLEND_SHAPE_MODE_NORMALIZED);
+	ERR_FAIL_NULL_V(mesh, RS::BLEND_SHAPE_MODE_NORMALIZED);
 	return mesh->blend_shape_mode;
 }
 
 void MeshStorage::mesh_surface_update_vertex_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) {
 	Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-	ERR_FAIL_COND(!mesh);
+	ERR_FAIL_NULL(mesh);
 	ERR_FAIL_UNSIGNED_INDEX((uint32_t)p_surface, mesh->surface_count);
 	ERR_FAIL_COND(p_data.size() == 0);
 
@@ -387,7 +387,7 @@ void MeshStorage::mesh_surface_update_vertex_region(RID p_mesh, int p_surface, i
 
 void MeshStorage::mesh_surface_update_attribute_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) {
 	Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-	ERR_FAIL_COND(!mesh);
+	ERR_FAIL_NULL(mesh);
 	ERR_FAIL_UNSIGNED_INDEX((uint32_t)p_surface, mesh->surface_count);
 	ERR_FAIL_COND(p_data.size() == 0);
 
@@ -402,7 +402,7 @@ void MeshStorage::mesh_surface_update_attribute_region(RID p_mesh, int p_surface
 
 void MeshStorage::mesh_surface_update_skin_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) {
 	Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-	ERR_FAIL_COND(!mesh);
+	ERR_FAIL_NULL(mesh);
 	ERR_FAIL_UNSIGNED_INDEX((uint32_t)p_surface, mesh->surface_count);
 	ERR_FAIL_COND(p_data.size() == 0);
 
@@ -417,7 +417,7 @@ void MeshStorage::mesh_surface_update_skin_region(RID p_mesh, int p_surface, int
 
 void MeshStorage::mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) {
 	Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-	ERR_FAIL_COND(!mesh);
+	ERR_FAIL_NULL(mesh);
 	ERR_FAIL_UNSIGNED_INDEX((uint32_t)p_surface, mesh->surface_count);
 	mesh->surfaces[p_surface]->material = p_material;
 
@@ -427,7 +427,7 @@ void MeshStorage::mesh_surface_set_material(RID p_mesh, int p_surface, RID p_mat
 
 RID MeshStorage::mesh_surface_get_material(RID p_mesh, int p_surface) const {
 	Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-	ERR_FAIL_COND_V(!mesh, RID());
+	ERR_FAIL_NULL_V(mesh, RID());
 	ERR_FAIL_UNSIGNED_INDEX_V((uint32_t)p_surface, mesh->surface_count, RID());
 
 	return mesh->surfaces[p_surface]->material;
@@ -435,7 +435,7 @@ RID MeshStorage::mesh_surface_get_material(RID p_mesh, int p_surface) const {
 
 RS::SurfaceData MeshStorage::mesh_get_surface(RID p_mesh, int p_surface) const {
 	Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-	ERR_FAIL_COND_V(!mesh, RS::SurfaceData());
+	ERR_FAIL_NULL_V(mesh, RS::SurfaceData());
 	ERR_FAIL_UNSIGNED_INDEX_V((uint32_t)p_surface, mesh->surface_count, RS::SurfaceData());
 
 	Mesh::Surface &s = *mesh->surfaces[p_surface];
@@ -484,13 +484,13 @@ RS::SurfaceData MeshStorage::mesh_get_surface(RID p_mesh, int p_surface) const {
 
 int MeshStorage::mesh_get_surface_count(RID p_mesh) const {
 	Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-	ERR_FAIL_COND_V(!mesh, 0);
+	ERR_FAIL_NULL_V(mesh, 0);
 	return mesh->surface_count;
 }
 
 void MeshStorage::mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) {
 	Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-	ERR_FAIL_COND(!mesh);
+	ERR_FAIL_NULL(mesh);
 	mesh->custom_aabb = p_aabb;
 
 	mesh->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_AABB);
@@ -498,13 +498,13 @@ void MeshStorage::mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) {
 
 AABB MeshStorage::mesh_get_custom_aabb(RID p_mesh) const {
 	Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-	ERR_FAIL_COND_V(!mesh, AABB());
+	ERR_FAIL_NULL_V(mesh, AABB());
 	return mesh->custom_aabb;
 }
 
 AABB MeshStorage::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
 	Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-	ERR_FAIL_COND_V(!mesh, AABB());
+	ERR_FAIL_NULL_V(mesh, AABB());
 
 	if (mesh->custom_aabb != AABB()) {
 		return mesh->custom_aabb;
@@ -613,7 +613,7 @@ AABB MeshStorage::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
 
 void MeshStorage::mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh) {
 	Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-	ERR_FAIL_COND(!mesh);
+	ERR_FAIL_NULL(mesh);
 
 	Mesh *shadow_mesh = mesh_owner.get_or_null(mesh->shadow_mesh);
 	if (shadow_mesh) {
@@ -632,7 +632,7 @@ void MeshStorage::mesh_set_shadow_mesh(RID p_mesh, RID p_shadow_mesh) {
 
 void MeshStorage::mesh_clear(RID p_mesh) {
 	Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-	ERR_FAIL_COND(!mesh);
+	ERR_FAIL_NULL(mesh);
 
 	// Clear instance data before mesh data.
 	for (MeshInstance *mi : mesh->instances) {
@@ -862,7 +862,7 @@ void MeshStorage::_mesh_surface_generate_version_for_input_mask(Mesh::Surface::V
 
 RID MeshStorage::mesh_instance_create(RID p_base) {
 	Mesh *mesh = mesh_owner.get_or_null(p_base);
-	ERR_FAIL_COND_V(!mesh, RID());
+	ERR_FAIL_NULL_V(mesh, RID());
 
 	RID rid = mesh_instance_owner.make_rid();
 	MeshInstance *mi = mesh_instance_owner.get_or_null(rid);
@@ -901,7 +901,7 @@ void MeshStorage::mesh_instance_set_skeleton(RID p_mesh_instance, RID p_skeleton
 
 void MeshStorage::mesh_instance_set_blend_shape_weight(RID p_mesh_instance, int p_shape, float p_weight) {
 	MeshInstance *mi = mesh_instance_owner.get_or_null(p_mesh_instance);
-	ERR_FAIL_COND(!mi);
+	ERR_FAIL_NULL(mi);
 	ERR_FAIL_INDEX(p_shape, (int)mi->blend_weights.size());
 	mi->blend_weights[p_shape] = p_weight;
 	mi->dirty = true;
@@ -1268,7 +1268,7 @@ void MeshStorage::multimesh_free(RID p_rid) {
 
 void MeshStorage::multimesh_allocate_data(RID p_multimesh, int p_instances, RS::MultimeshTransformFormat p_transform_format, bool p_use_colors, bool p_use_custom_data) {
 	MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
-	ERR_FAIL_COND(!multimesh);
+	ERR_FAIL_NULL(multimesh);
 
 	if (multimesh->instances == p_instances && multimesh->xform_format == p_transform_format && multimesh->uses_colors == p_use_colors && multimesh->uses_custom_data == p_use_custom_data) {
 		return;
@@ -1315,13 +1315,13 @@ void MeshStorage::multimesh_allocate_data(RID p_multimesh, int p_instances, RS::
 
 int MeshStorage::multimesh_get_instance_count(RID p_multimesh) const {
 	MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
-	ERR_FAIL_COND_V(!multimesh, 0);
+	ERR_FAIL_NULL_V(multimesh, 0);
 	return multimesh->instances;
 }
 
 void MeshStorage::multimesh_set_mesh(RID p_multimesh, RID p_mesh) {
 	MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
-	ERR_FAIL_COND(!multimesh);
+	ERR_FAIL_NULL(multimesh);
 	if (multimesh->mesh == p_mesh || p_mesh.is_null()) {
 		return;
 	}
@@ -1468,7 +1468,7 @@ void MeshStorage::_multimesh_re_create_aabb(MultiMesh *multimesh, const float *p
 
 void MeshStorage::multimesh_instance_set_transform(RID p_multimesh, int p_index, const Transform3D &p_transform) {
 	MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
-	ERR_FAIL_COND(!multimesh);
+	ERR_FAIL_NULL(multimesh);
 	ERR_FAIL_INDEX(p_index, multimesh->instances);
 	ERR_FAIL_COND(multimesh->xform_format != RS::MULTIMESH_TRANSFORM_3D);
 
@@ -1498,7 +1498,7 @@ void MeshStorage::multimesh_instance_set_transform(RID p_multimesh, int p_index,
 
 void MeshStorage::multimesh_instance_set_transform_2d(RID p_multimesh, int p_index, const Transform2D &p_transform) {
 	MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
-	ERR_FAIL_COND(!multimesh);
+	ERR_FAIL_NULL(multimesh);
 	ERR_FAIL_INDEX(p_index, multimesh->instances);
 	ERR_FAIL_COND(multimesh->xform_format != RS::MULTIMESH_TRANSFORM_2D);
 
@@ -1524,7 +1524,7 @@ void MeshStorage::multimesh_instance_set_transform_2d(RID p_multimesh, int p_ind
 
 void MeshStorage::multimesh_instance_set_color(RID p_multimesh, int p_index, const Color &p_color) {
 	MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
-	ERR_FAIL_COND(!multimesh);
+	ERR_FAIL_NULL(multimesh);
 	ERR_FAIL_INDEX(p_index, multimesh->instances);
 	ERR_FAIL_COND(!multimesh->uses_colors);
 
@@ -1544,7 +1544,7 @@ void MeshStorage::multimesh_instance_set_color(RID p_multimesh, int p_index, con
 
 void MeshStorage::multimesh_instance_set_custom_data(RID p_multimesh, int p_index, const Color &p_color) {
 	MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
-	ERR_FAIL_COND(!multimesh);
+	ERR_FAIL_NULL(multimesh);
 	ERR_FAIL_INDEX(p_index, multimesh->instances);
 	ERR_FAIL_COND(!multimesh->uses_custom_data);
 
@@ -1563,14 +1563,14 @@ void MeshStorage::multimesh_instance_set_custom_data(RID p_multimesh, int p_inde
 
 RID MeshStorage::multimesh_get_mesh(RID p_multimesh) const {
 	MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
-	ERR_FAIL_COND_V(!multimesh, RID());
+	ERR_FAIL_NULL_V(multimesh, RID());
 
 	return multimesh->mesh;
 }
 
 AABB MeshStorage::multimesh_get_aabb(RID p_multimesh) const {
 	MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
-	ERR_FAIL_COND_V(!multimesh, AABB());
+	ERR_FAIL_NULL_V(multimesh, AABB());
 	if (multimesh->aabb_dirty) {
 		const_cast<MeshStorage *>(this)->_update_dirty_multimeshes();
 	}
@@ -1579,7 +1579,7 @@ AABB MeshStorage::multimesh_get_aabb(RID p_multimesh) const {
 
 Transform3D MeshStorage::multimesh_instance_get_transform(RID p_multimesh, int p_index) const {
 	MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
-	ERR_FAIL_COND_V(!multimesh, Transform3D());
+	ERR_FAIL_NULL_V(multimesh, Transform3D());
 	ERR_FAIL_INDEX_V(p_index, multimesh->instances, Transform3D());
 	ERR_FAIL_COND_V(multimesh->xform_format != RS::MULTIMESH_TRANSFORM_3D, Transform3D());
 
@@ -1610,7 +1610,7 @@ Transform3D MeshStorage::multimesh_instance_get_transform(RID p_multimesh, int p
 
 Transform2D MeshStorage::multimesh_instance_get_transform_2d(RID p_multimesh, int p_index) const {
 	MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
-	ERR_FAIL_COND_V(!multimesh, Transform2D());
+	ERR_FAIL_NULL_V(multimesh, Transform2D());
 	ERR_FAIL_INDEX_V(p_index, multimesh->instances, Transform2D());
 	ERR_FAIL_COND_V(multimesh->xform_format != RS::MULTIMESH_TRANSFORM_2D, Transform2D());
 
@@ -1635,7 +1635,7 @@ Transform2D MeshStorage::multimesh_instance_get_transform_2d(RID p_multimesh, in
 
 Color MeshStorage::multimesh_instance_get_color(RID p_multimesh, int p_index) const {
 	MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
-	ERR_FAIL_COND_V(!multimesh, Color());
+	ERR_FAIL_NULL_V(multimesh, Color());
 	ERR_FAIL_INDEX_V(p_index, multimesh->instances, Color());
 	ERR_FAIL_COND_V(!multimesh->uses_colors, Color());
 
@@ -1659,7 +1659,7 @@ Color MeshStorage::multimesh_instance_get_color(RID p_multimesh, int p_index) co
 
 Color MeshStorage::multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const {
 	MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
-	ERR_FAIL_COND_V(!multimesh, Color());
+	ERR_FAIL_NULL_V(multimesh, Color());
 	ERR_FAIL_INDEX_V(p_index, multimesh->instances, Color());
 	ERR_FAIL_COND_V(!multimesh->uses_custom_data, Color());
 
@@ -1683,7 +1683,7 @@ Color MeshStorage::multimesh_instance_get_custom_data(RID p_multimesh, int p_ind
 
 void MeshStorage::multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_buffer) {
 	MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
-	ERR_FAIL_COND(!multimesh);
+	ERR_FAIL_NULL(multimesh);
 
 	if (multimesh->uses_colors || multimesh->uses_custom_data) {
 		// Color and custom need to be packed so copy buffer to data_cache and pack.
@@ -1769,7 +1769,7 @@ void MeshStorage::multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_b
 
 Vector<float> MeshStorage::multimesh_get_buffer(RID p_multimesh) const {
 	MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
-	ERR_FAIL_COND_V(!multimesh, Vector<float>());
+	ERR_FAIL_NULL_V(multimesh, Vector<float>());
 	Vector<float> ret;
 	if (multimesh->buffer == 0 || multimesh->instances == 0) {
 		return Vector<float>();
@@ -1841,7 +1841,7 @@ Vector<float> MeshStorage::multimesh_get_buffer(RID p_multimesh) const {
 
 void MeshStorage::multimesh_set_visible_instances(RID p_multimesh, int p_visible) {
 	MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
-	ERR_FAIL_COND(!multimesh);
+	ERR_FAIL_NULL(multimesh);
 	ERR_FAIL_COND(p_visible < -1 || p_visible > multimesh->instances);
 	if (multimesh->visible_instances == p_visible) {
 		return;
@@ -1863,7 +1863,7 @@ void MeshStorage::multimesh_set_visible_instances(RID p_multimesh, int p_visible
 
 int MeshStorage::multimesh_get_visible_instances(RID p_multimesh) const {
 	MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
-	ERR_FAIL_COND_V(!multimesh, 0);
+	ERR_FAIL_NULL_V(multimesh, 0);
 	return multimesh->visible_instances;
 }
 
@@ -1953,7 +1953,7 @@ void MeshStorage::_skeleton_make_dirty(Skeleton *skeleton) {
 
 void MeshStorage::skeleton_allocate_data(RID p_skeleton, int p_bones, bool p_2d_skeleton) {
 	Skeleton *skeleton = skeleton_owner.get_or_null(p_skeleton);
-	ERR_FAIL_COND(!skeleton);
+	ERR_FAIL_NULL(skeleton);
 	ERR_FAIL_COND(p_bones < 0);
 
 	if (skeleton->size == p_bones && skeleton->use_2d == p_2d_skeleton) {
@@ -2004,7 +2004,7 @@ void MeshStorage::skeleton_set_base_transform_2d(RID p_skeleton, const Transform
 
 int MeshStorage::skeleton_get_bone_count(RID p_skeleton) const {
 	Skeleton *skeleton = skeleton_owner.get_or_null(p_skeleton);
-	ERR_FAIL_COND_V(!skeleton, 0);
+	ERR_FAIL_NULL_V(skeleton, 0);
 
 	return skeleton->size;
 }
@@ -2012,7 +2012,7 @@ int MeshStorage::skeleton_get_bone_count(RID p_skeleton) const {
 void MeshStorage::skeleton_bone_set_transform(RID p_skeleton, int p_bone, const Transform3D &p_transform) {
 	Skeleton *skeleton = skeleton_owner.get_or_null(p_skeleton);
 
-	ERR_FAIL_COND(!skeleton);
+	ERR_FAIL_NULL(skeleton);
 	ERR_FAIL_INDEX(p_bone, skeleton->size);
 	ERR_FAIL_COND(skeleton->use_2d);
 
@@ -2037,7 +2037,7 @@ void MeshStorage::skeleton_bone_set_transform(RID p_skeleton, int p_bone, const
 Transform3D MeshStorage::skeleton_bone_get_transform(RID p_skeleton, int p_bone) const {
 	Skeleton *skeleton = skeleton_owner.get_or_null(p_skeleton);
 
-	ERR_FAIL_COND_V(!skeleton, Transform3D());
+	ERR_FAIL_NULL_V(skeleton, Transform3D());
 	ERR_FAIL_INDEX_V(p_bone, skeleton->size, Transform3D());
 	ERR_FAIL_COND_V(skeleton->use_2d, Transform3D());
 
@@ -2064,7 +2064,7 @@ Transform3D MeshStorage::skeleton_bone_get_transform(RID p_skeleton, int p_bone)
 void MeshStorage::skeleton_bone_set_transform_2d(RID p_skeleton, int p_bone, const Transform2D &p_transform) {
 	Skeleton *skeleton = skeleton_owner.get_or_null(p_skeleton);
 
-	ERR_FAIL_COND(!skeleton);
+	ERR_FAIL_NULL(skeleton);
 	ERR_FAIL_INDEX(p_bone, skeleton->size);
 	ERR_FAIL_COND(!skeleton->use_2d);
 
@@ -2085,7 +2085,7 @@ void MeshStorage::skeleton_bone_set_transform_2d(RID p_skeleton, int p_bone, con
 Transform2D MeshStorage::skeleton_bone_get_transform_2d(RID p_skeleton, int p_bone) const {
 	Skeleton *skeleton = skeleton_owner.get_or_null(p_skeleton);
 
-	ERR_FAIL_COND_V(!skeleton, Transform2D());
+	ERR_FAIL_NULL_V(skeleton, Transform2D());
 	ERR_FAIL_INDEX_V(p_bone, skeleton->size, Transform2D());
 	ERR_FAIL_COND_V(!skeleton->use_2d, Transform2D());
 
@@ -2127,7 +2127,7 @@ void MeshStorage::_update_dirty_skeletons() {
 
 void MeshStorage::skeleton_update_dependency(RID p_skeleton, DependencyTracker *p_instance) {
 	Skeleton *skeleton = skeleton_owner.get_or_null(p_skeleton);
-	ERR_FAIL_COND(!skeleton);
+	ERR_FAIL_NULL(skeleton);
 
 	p_instance->update_dependency(&skeleton->dependency);
 }

+ 5 - 5
drivers/gles3/storage/mesh_storage.h

@@ -302,7 +302,7 @@ public:
 
 	_FORCE_INLINE_ const RID *mesh_get_surface_count_and_materials(RID p_mesh, uint32_t &r_surface_count) {
 		Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-		ERR_FAIL_COND_V(!mesh, nullptr);
+		ERR_FAIL_NULL_V(mesh, nullptr);
 		r_surface_count = mesh->surface_count;
 		if (r_surface_count == 0) {
 			return nullptr;
@@ -319,7 +319,7 @@ public:
 
 	_FORCE_INLINE_ void *mesh_get_surface(RID p_mesh, uint32_t p_surface_index) {
 		Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-		ERR_FAIL_COND_V(!mesh, nullptr);
+		ERR_FAIL_NULL_V(mesh, nullptr);
 		ERR_FAIL_UNSIGNED_INDEX_V(p_surface_index, mesh->surface_count, nullptr);
 
 		return mesh->surfaces[p_surface_index];
@@ -327,7 +327,7 @@ public:
 
 	_FORCE_INLINE_ RID mesh_get_shadow_mesh(RID p_mesh) {
 		Mesh *mesh = mesh_owner.get_or_null(p_mesh);
-		ERR_FAIL_COND_V(!mesh, RID());
+		ERR_FAIL_NULL_V(mesh, RID());
 
 		return mesh->shadow_mesh;
 	}
@@ -349,7 +349,7 @@ public:
 
 	_FORCE_INLINE_ uint32_t mesh_surface_get_lod(void *p_surface, float p_model_scale, float p_distance_threshold, float p_mesh_lod_threshold, uint32_t &r_index_count) const {
 		Mesh::Surface *s = reinterpret_cast<Mesh::Surface *>(p_surface);
-		ERR_FAIL_COND_V(!s, 0);
+		ERR_FAIL_NULL_V(s, 0);
 
 		int32_t current_lod = -1;
 		r_index_count = s->index_count;
@@ -431,7 +431,7 @@ public:
 	// Doing so would allow us to avoid specifying multimesh buffer pointers every frame and may improve performance.
 	_FORCE_INLINE_ void mesh_instance_surface_get_vertex_arrays_and_format(RID p_mesh_instance, uint32_t p_surface_index, uint32_t p_input_mask, GLuint &r_vertex_array_gl) {
 		MeshInstance *mi = mesh_instance_owner.get_or_null(p_mesh_instance);
-		ERR_FAIL_COND(!mi);
+		ERR_FAIL_NULL(mi);
 		Mesh *mesh = mi->mesh;
 		ERR_FAIL_UNSIGNED_INDEX(p_surface_index, mesh->surface_count);
 

+ 50 - 50
drivers/gles3/storage/particles_storage.cpp

@@ -107,7 +107,7 @@ void ParticlesStorage::particles_free(RID p_rid) {
 
 void ParticlesStorage::particles_set_mode(RID p_particles, RS::ParticlesMode p_mode) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 	if (particles->mode == p_mode) {
 		return;
 	}
@@ -119,7 +119,7 @@ void ParticlesStorage::particles_set_mode(RID p_particles, RS::ParticlesMode p_m
 
 void ParticlesStorage::particles_set_emitting(RID p_particles, bool p_emitting) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 
 	particles->emitting = p_emitting;
 }
@@ -127,7 +127,7 @@ void ParticlesStorage::particles_set_emitting(RID p_particles, bool p_emitting)
 bool ParticlesStorage::particles_get_emitting(RID p_particles) {
 	ERR_FAIL_COND_V_MSG(RSG::threaded, false, "This function should never be used with threaded rendering, as it stalls the renderer.");
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND_V(!particles, false);
+	ERR_FAIL_NULL_V(particles, false);
 
 	return particles->emitting;
 }
@@ -172,7 +172,7 @@ void ParticlesStorage::_particles_free_data(Particles *particles) {
 
 void ParticlesStorage::particles_set_amount(RID p_particles, int p_amount) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 
 	if (particles->amount == p_amount) {
 		return;
@@ -192,48 +192,48 @@ void ParticlesStorage::particles_set_amount(RID p_particles, int p_amount) {
 
 void ParticlesStorage::particles_set_lifetime(RID p_particles, double p_lifetime) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 	particles->lifetime = p_lifetime;
 }
 
 void ParticlesStorage::particles_set_one_shot(RID p_particles, bool p_one_shot) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 	particles->one_shot = p_one_shot;
 }
 
 void ParticlesStorage::particles_set_pre_process_time(RID p_particles, double p_time) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 	particles->pre_process_time = p_time;
 }
 void ParticlesStorage::particles_set_explosiveness_ratio(RID p_particles, real_t p_ratio) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 	particles->explosiveness = p_ratio;
 }
 void ParticlesStorage::particles_set_randomness_ratio(RID p_particles, real_t p_ratio) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 	particles->randomness = p_ratio;
 }
 
 void ParticlesStorage::particles_set_custom_aabb(RID p_particles, const AABB &p_aabb) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 	particles->custom_aabb = p_aabb;
 	particles->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_AABB);
 }
 
 void ParticlesStorage::particles_set_speed_scale(RID p_particles, double p_scale) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 
 	particles->speed_scale = p_scale;
 }
 void ParticlesStorage::particles_set_use_local_coordinates(RID p_particles, bool p_enable) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 
 	particles->use_local_coords = p_enable;
 	particles->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_PARTICLES);
@@ -241,7 +241,7 @@ void ParticlesStorage::particles_set_use_local_coordinates(RID p_particles, bool
 
 void ParticlesStorage::particles_set_fixed_fps(RID p_particles, int p_fps) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 
 	particles->fixed_fps = p_fps;
 
@@ -257,14 +257,14 @@ void ParticlesStorage::particles_set_fixed_fps(RID p_particles, int p_fps) {
 
 void ParticlesStorage::particles_set_interpolate(RID p_particles, bool p_enable) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 
 	particles->interpolate = p_enable;
 }
 
 void ParticlesStorage::particles_set_fractional_delta(RID p_particles, bool p_enable) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 
 	particles->fractional_delta = p_enable;
 }
@@ -283,21 +283,21 @@ void ParticlesStorage::particles_set_trail_bind_poses(RID p_particles, const Vec
 
 void ParticlesStorage::particles_set_collision_base_size(RID p_particles, real_t p_size) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 
 	particles->collision_base_size = p_size;
 }
 
 void ParticlesStorage::particles_set_transform_align(RID p_particles, RS::ParticlesTransformAlign p_transform_align) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 
 	particles->transform_align = p_transform_align;
 }
 
 void ParticlesStorage::particles_set_process_material(RID p_particles, RID p_material) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 
 	particles->process_material = p_material;
 	particles->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_PARTICLES); //the instance buffer may have changed
@@ -305,28 +305,28 @@ void ParticlesStorage::particles_set_process_material(RID p_particles, RID p_mat
 
 RID ParticlesStorage::particles_get_process_material(RID p_particles) const {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND_V(!particles, RID());
+	ERR_FAIL_NULL_V(particles, RID());
 
 	return particles->process_material;
 }
 
 void ParticlesStorage::particles_set_draw_order(RID p_particles, RS::ParticlesDrawOrder p_order) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 
 	particles->draw_order = p_order;
 }
 
 void ParticlesStorage::particles_set_draw_passes(RID p_particles, int p_passes) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 
 	particles->draw_passes.resize(p_passes);
 }
 
 void ParticlesStorage::particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 	ERR_FAIL_INDEX(p_pass, particles->draw_passes.size());
 	particles->draw_passes.write[p_pass] = p_mesh;
 	particles->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_PARTICLES);
@@ -334,7 +334,7 @@ void ParticlesStorage::particles_set_draw_pass_mesh(RID p_particles, int p_pass,
 
 void ParticlesStorage::particles_restart(RID p_particles) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 
 	particles->restart_request = true;
 }
@@ -351,7 +351,7 @@ void ParticlesStorage::particles_emit(RID p_particles, const Transform3D &p_tran
 
 void ParticlesStorage::particles_request_process(RID p_particles) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 
 	if (!particles->dirty) {
 		particles->dirty = true;
@@ -366,7 +366,7 @@ AABB ParticlesStorage::particles_get_current_aabb(RID p_particles) {
 	}
 
 	const Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND_V(!particles, AABB());
+	ERR_FAIL_NULL_V(particles, AABB());
 
 	int total_amount = particles->amount;
 
@@ -419,28 +419,28 @@ AABB ParticlesStorage::particles_get_current_aabb(RID p_particles) {
 
 AABB ParticlesStorage::particles_get_aabb(RID p_particles) const {
 	const Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND_V(!particles, AABB());
+	ERR_FAIL_NULL_V(particles, AABB());
 
 	return particles->custom_aabb;
 }
 
 void ParticlesStorage::particles_set_emission_transform(RID p_particles, const Transform3D &p_transform) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 
 	particles->emission_transform = p_transform;
 }
 
 int ParticlesStorage::particles_get_draw_passes(RID p_particles) const {
 	const Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND_V(!particles, 0);
+	ERR_FAIL_NULL_V(particles, 0);
 
 	return particles->draw_passes.size();
 }
 
 RID ParticlesStorage::particles_get_draw_pass_mesh(RID p_particles, int p_pass) const {
 	const Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND_V(!particles, RID());
+	ERR_FAIL_NULL_V(particles, RID());
 	ERR_FAIL_INDEX_V(p_pass, particles->draw_passes.size(), RID());
 
 	return particles->draw_passes[p_pass];
@@ -448,19 +448,19 @@ RID ParticlesStorage::particles_get_draw_pass_mesh(RID p_particles, int p_pass)
 
 void ParticlesStorage::particles_add_collision(RID p_particles, RID p_particles_collision_instance) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 	particles->collisions.insert(p_particles_collision_instance);
 }
 
 void ParticlesStorage::particles_remove_collision(RID p_particles, RID p_particles_collision_instance) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 	particles->collisions.erase(p_particles_collision_instance);
 }
 
 void ParticlesStorage::particles_set_canvas_sdf_collision(RID p_particles, bool p_enable, const Transform2D &p_xform, const Rect2 &p_to_screen, GLuint p_texture) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 	particles->has_sdf_collision = p_enable;
 	particles->sdf_collision_transform = p_xform;
 	particles->sdf_collision_to_screen = p_to_screen;
@@ -694,7 +694,7 @@ void ParticlesStorage::_particles_process(Particles *p_particles, double p_delta
 		m = static_cast<ParticleProcessMaterialData *>(material_storage->material_get_data(particles_shader.default_material, RS::SHADER_PARTICLES));
 	}
 
-	ERR_FAIL_COND(!m);
+	ERR_FAIL_NULL(m);
 
 	ParticlesShaderGLES3::ShaderVariant variant = ParticlesShaderGLES3::MODE_DEFAULT;
 
@@ -745,7 +745,7 @@ void ParticlesStorage::_particles_process(Particles *p_particles, double p_delta
 
 void ParticlesStorage::particles_set_view_axis(RID p_particles, const Vector3 &p_axis, const Vector3 &p_up_axis) {
 	Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND(!particles);
+	ERR_FAIL_NULL(particles);
 
 	if (particles->draw_order != RS::PARTICLES_DRAW_ORDER_VIEW_DEPTH && particles->transform_align != RS::PARTICLES_TRANSFORM_ALIGN_Z_BILLBOARD && particles->transform_align != RS::PARTICLES_TRANSFORM_ALIGN_Z_BILLBOARD_Y_TO_VELOCITY) {
 		return;
@@ -1163,7 +1163,7 @@ Dependency *ParticlesStorage::particles_get_dependency(RID p_particles) const {
 bool ParticlesStorage::particles_is_inactive(RID p_particles) const {
 	ERR_FAIL_COND_V_MSG(RSG::threaded, false, "This function should never be used with threaded rendering, as it stalls the renderer.");
 	const Particles *particles = particles_owner.get_or_null(p_particles);
-	ERR_FAIL_COND_V(!particles, false);
+	ERR_FAIL_NULL_V(particles, false);
 	return !particles->emitting && particles->inactive;
 }
 
@@ -1191,7 +1191,7 @@ void ParticlesStorage::particles_collision_free(RID p_rid) {
 
 GLuint ParticlesStorage::particles_collision_get_heightfield_framebuffer(RID p_particles_collision) const {
 	ParticlesCollision *particles_collision = particles_collision_owner.get_or_null(p_particles_collision);
-	ERR_FAIL_COND_V(!particles_collision, 0);
+	ERR_FAIL_NULL_V(particles_collision, 0);
 	ERR_FAIL_COND_V(particles_collision->type != RS::PARTICLES_COLLISION_TYPE_HEIGHTFIELD_COLLIDE, 0);
 
 	if (particles_collision->heightfield_texture == 0) {
@@ -1240,7 +1240,7 @@ GLuint ParticlesStorage::particles_collision_get_heightfield_framebuffer(RID p_p
 
 void ParticlesStorage::particles_collision_set_collision_type(RID p_particles_collision, RS::ParticlesCollisionType p_type) {
 	ParticlesCollision *particles_collision = particles_collision_owner.get_or_null(p_particles_collision);
-	ERR_FAIL_COND(!particles_collision);
+	ERR_FAIL_NULL(particles_collision);
 
 	if (p_type == particles_collision->type) {
 		return;
@@ -1259,13 +1259,13 @@ void ParticlesStorage::particles_collision_set_collision_type(RID p_particles_co
 
 void ParticlesStorage::particles_collision_set_cull_mask(RID p_particles_collision, uint32_t p_cull_mask) {
 	ParticlesCollision *particles_collision = particles_collision_owner.get_or_null(p_particles_collision);
-	ERR_FAIL_COND(!particles_collision);
+	ERR_FAIL_NULL(particles_collision);
 	particles_collision->cull_mask = p_cull_mask;
 }
 
 void ParticlesStorage::particles_collision_set_sphere_radius(RID p_particles_collision, real_t p_radius) {
 	ParticlesCollision *particles_collision = particles_collision_owner.get_or_null(p_particles_collision);
-	ERR_FAIL_COND(!particles_collision);
+	ERR_FAIL_NULL(particles_collision);
 
 	particles_collision->radius = p_radius;
 	particles_collision->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_AABB);
@@ -1273,7 +1273,7 @@ void ParticlesStorage::particles_collision_set_sphere_radius(RID p_particles_col
 
 void ParticlesStorage::particles_collision_set_box_extents(RID p_particles_collision, const Vector3 &p_extents) {
 	ParticlesCollision *particles_collision = particles_collision_owner.get_or_null(p_particles_collision);
-	ERR_FAIL_COND(!particles_collision);
+	ERR_FAIL_NULL(particles_collision);
 
 	particles_collision->extents = p_extents;
 	particles_collision->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_AABB);
@@ -1281,21 +1281,21 @@ void ParticlesStorage::particles_collision_set_box_extents(RID p_particles_colli
 
 void ParticlesStorage::particles_collision_set_attractor_strength(RID p_particles_collision, real_t p_strength) {
 	ParticlesCollision *particles_collision = particles_collision_owner.get_or_null(p_particles_collision);
-	ERR_FAIL_COND(!particles_collision);
+	ERR_FAIL_NULL(particles_collision);
 
 	particles_collision->attractor_strength = p_strength;
 }
 
 void ParticlesStorage::particles_collision_set_attractor_directionality(RID p_particles_collision, real_t p_directionality) {
 	ParticlesCollision *particles_collision = particles_collision_owner.get_or_null(p_particles_collision);
-	ERR_FAIL_COND(!particles_collision);
+	ERR_FAIL_NULL(particles_collision);
 
 	particles_collision->attractor_directionality = p_directionality;
 }
 
 void ParticlesStorage::particles_collision_set_attractor_attenuation(RID p_particles_collision, real_t p_curve) {
 	ParticlesCollision *particles_collision = particles_collision_owner.get_or_null(p_particles_collision);
-	ERR_FAIL_COND(!particles_collision);
+	ERR_FAIL_NULL(particles_collision);
 
 	particles_collision->attractor_attenuation = p_curve;
 }
@@ -1306,13 +1306,13 @@ void ParticlesStorage::particles_collision_set_field_texture(RID p_particles_col
 
 void ParticlesStorage::particles_collision_height_field_update(RID p_particles_collision) {
 	ParticlesCollision *particles_collision = particles_collision_owner.get_or_null(p_particles_collision);
-	ERR_FAIL_COND(!particles_collision);
+	ERR_FAIL_NULL(particles_collision);
 	particles_collision->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_AABB);
 }
 
 void ParticlesStorage::particles_collision_set_height_field_resolution(RID p_particles_collision, RS::ParticlesCollisionHeightfieldResolution p_resolution) {
 	ParticlesCollision *particles_collision = particles_collision_owner.get_or_null(p_particles_collision);
-	ERR_FAIL_COND(!particles_collision);
+	ERR_FAIL_NULL(particles_collision);
 	ERR_FAIL_INDEX(p_resolution, RS::PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_MAX);
 
 	if (particles_collision->heightfield_resolution == p_resolution) {
@@ -1331,7 +1331,7 @@ void ParticlesStorage::particles_collision_set_height_field_resolution(RID p_par
 
 AABB ParticlesStorage::particles_collision_get_aabb(RID p_particles_collision) const {
 	ParticlesCollision *particles_collision = particles_collision_owner.get_or_null(p_particles_collision);
-	ERR_FAIL_COND_V(!particles_collision, AABB());
+	ERR_FAIL_NULL_V(particles_collision, AABB());
 
 	switch (particles_collision->type) {
 		case RS::PARTICLES_COLLISION_TYPE_SPHERE_ATTRACT:
@@ -1352,13 +1352,13 @@ AABB ParticlesStorage::particles_collision_get_aabb(RID p_particles_collision) c
 
 Vector3 ParticlesStorage::particles_collision_get_extents(RID p_particles_collision) const {
 	const ParticlesCollision *particles_collision = particles_collision_owner.get_or_null(p_particles_collision);
-	ERR_FAIL_COND_V(!particles_collision, Vector3());
+	ERR_FAIL_NULL_V(particles_collision, Vector3());
 	return particles_collision->extents;
 }
 
 bool ParticlesStorage::particles_collision_is_heightfield(RID p_particles_collision) const {
 	const ParticlesCollision *particles_collision = particles_collision_owner.get_or_null(p_particles_collision);
-	ERR_FAIL_COND_V(!particles_collision, false);
+	ERR_FAIL_NULL_V(particles_collision, false);
 	return particles_collision->type == RS::PARTICLES_COLLISION_TYPE_HEIGHTFIELD_COLLIDE;
 }
 
@@ -1383,13 +1383,13 @@ void ParticlesStorage::particles_collision_instance_free(RID p_rid) {
 
 void ParticlesStorage::particles_collision_instance_set_transform(RID p_collision_instance, const Transform3D &p_transform) {
 	ParticlesCollisionInstance *pci = particles_collision_instance_owner.get_or_null(p_collision_instance);
-	ERR_FAIL_COND(!pci);
+	ERR_FAIL_NULL(pci);
 	pci->transform = p_transform;
 }
 
 void ParticlesStorage::particles_collision_instance_set_active(RID p_collision_instance, bool p_active) {
 	ParticlesCollisionInstance *pci = particles_collision_instance_owner.get_or_null(p_collision_instance);
-	ERR_FAIL_COND(!pci);
+	ERR_FAIL_NULL(pci);
 	pci->active = p_active;
 }
 

+ 5 - 5
drivers/gles3/storage/particles_storage.h

@@ -367,13 +367,13 @@ public:
 
 	_FORCE_INLINE_ RS::ParticlesMode particles_get_mode(RID p_particles) {
 		Particles *particles = particles_owner.get_or_null(p_particles);
-		ERR_FAIL_COND_V(!particles, RS::PARTICLES_MODE_2D);
+		ERR_FAIL_NULL_V(particles, RS::PARTICLES_MODE_2D);
 		return particles->mode;
 	}
 
 	_FORCE_INLINE_ uint32_t particles_get_amount(RID p_particles) {
 		Particles *particles = particles_owner.get_or_null(p_particles);
-		ERR_FAIL_COND_V(!particles, 0);
+		ERR_FAIL_NULL_V(particles, 0);
 
 		return particles->amount;
 	}
@@ -389,14 +389,14 @@ public:
 
 	_FORCE_INLINE_ bool particles_has_collision(RID p_particles) {
 		Particles *particles = particles_owner.get_or_null(p_particles);
-		ERR_FAIL_COND_V(!particles, 0);
+		ERR_FAIL_NULL_V(particles, 0);
 
 		return particles->has_collision_cache;
 	}
 
 	_FORCE_INLINE_ uint32_t particles_is_using_local_coords(RID p_particles) {
 		Particles *particles = particles_owner.get_or_null(p_particles);
-		ERR_FAIL_COND_V(!particles, false);
+		ERR_FAIL_NULL_V(particles, false);
 
 		return particles->use_local_coords;
 	}
@@ -427,7 +427,7 @@ public:
 
 	_FORCE_INLINE_ Size2i particles_collision_get_heightfield_size(RID p_particles_collision) const {
 		ParticlesCollision *particles_collision = particles_collision_owner.get_or_null(p_particles_collision);
-		ERR_FAIL_COND_V(!particles_collision, Size2i());
+		ERR_FAIL_NULL_V(particles_collision, Size2i());
 		ERR_FAIL_COND_V(particles_collision->type != RS::PARTICLES_COLLISION_TYPE_HEIGHTFIELD_COLLIDE, Size2i());
 
 		return particles_collision->heightfield_fb_size;

+ 61 - 61
drivers/gles3/storage/texture_storage.cpp

@@ -702,7 +702,7 @@ RID TextureStorage::texture_allocate() {
 
 void TextureStorage::texture_free(RID p_texture) {
 	Texture *t = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND(!t);
+	ERR_FAIL_NULL(t);
 	ERR_FAIL_COND(t->is_render_target);
 
 	if (t->canvas_texture) {
@@ -816,7 +816,7 @@ void TextureStorage::texture_3d_initialize(RID p_texture, Image::Format, int p_w
 // Note: p_base is the root and p_texture is the proxy.
 void TextureStorage::texture_proxy_initialize(RID p_texture, RID p_base) {
 	Texture *texture = texture_owner.get_or_null(p_base);
-	ERR_FAIL_COND(!texture);
+	ERR_FAIL_NULL(texture);
 	Texture proxy_tex;
 	proxy_tex.copy_from(*texture);
 	proxy_tex.proxy_to = p_base;
@@ -860,7 +860,7 @@ void TextureStorage::texture_2d_update(RID p_texture, const Ref<Image> &p_image,
 	texture_set_data(p_texture, p_image, p_layer);
 
 	Texture *tex = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND(!tex);
+	ERR_FAIL_NULL(tex);
 	GLES3::Utilities::get_singleton()->texture_resize_data(tex->tex_id, tex->total_data_size);
 
 #ifdef TOOLS_ENABLED
@@ -870,15 +870,15 @@ void TextureStorage::texture_2d_update(RID p_texture, const Ref<Image> &p_image,
 
 void TextureStorage::texture_proxy_update(RID p_texture, RID p_proxy_to) {
 	Texture *tex = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND(!tex);
+	ERR_FAIL_NULL(tex);
 	ERR_FAIL_COND(!tex->is_proxy);
 	Texture *proxy_to = texture_owner.get_or_null(p_proxy_to);
-	ERR_FAIL_COND(!proxy_to);
+	ERR_FAIL_NULL(proxy_to);
 	ERR_FAIL_COND(proxy_to->is_proxy);
 
 	if (tex->proxy_to.is_valid()) {
 		Texture *prev_tex = texture_owner.get_or_null(tex->proxy_to);
-		ERR_FAIL_COND(!prev_tex);
+		ERR_FAIL_NULL(prev_tex);
 		prev_tex->proxies.erase(p_texture);
 	}
 
@@ -938,7 +938,7 @@ void TextureStorage::texture_3d_placeholder_initialize(RID p_texture) {
 
 Ref<Image> TextureStorage::texture_2d_get(RID p_texture) const {
 	Texture *texture = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND_V(!texture, Ref<Image>());
+	ERR_FAIL_NULL_V(texture, Ref<Image>());
 
 #ifdef TOOLS_ENABLED
 	if (texture->image_cache_2d.is_valid() && !texture->is_render_target) {
@@ -1057,10 +1057,10 @@ Ref<Image> TextureStorage::texture_2d_get(RID p_texture) const {
 
 void TextureStorage::texture_replace(RID p_texture, RID p_by_texture) {
 	Texture *tex_to = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND(!tex_to);
+	ERR_FAIL_NULL(tex_to);
 	ERR_FAIL_COND(tex_to->is_proxy); //can't replace proxy
 	Texture *tex_from = texture_owner.get_or_null(p_by_texture);
-	ERR_FAIL_COND(!tex_from);
+	ERR_FAIL_NULL(tex_from);
 	ERR_FAIL_COND(tex_from->is_proxy); //can't replace proxy
 
 	if (tex_to == tex_from) {
@@ -1103,7 +1103,7 @@ void TextureStorage::texture_replace(RID p_texture, RID p_by_texture) {
 void TextureStorage::texture_set_size_override(RID p_texture, int p_width, int p_height) {
 	Texture *texture = texture_owner.get_or_null(p_texture);
 
-	ERR_FAIL_COND(!texture);
+	ERR_FAIL_NULL(texture);
 	ERR_FAIL_COND(texture->is_render_target);
 
 	ERR_FAIL_COND(p_width <= 0 || p_width > 16384);
@@ -1115,21 +1115,21 @@ void TextureStorage::texture_set_size_override(RID p_texture, int p_width, int p
 
 void TextureStorage::texture_set_path(RID p_texture, const String &p_path) {
 	Texture *texture = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND(!texture);
+	ERR_FAIL_NULL(texture);
 
 	texture->path = p_path;
 }
 
 String TextureStorage::texture_get_path(RID p_texture) const {
 	Texture *texture = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND_V(!texture, "");
+	ERR_FAIL_NULL_V(texture, "");
 
 	return texture->path;
 }
 
 void TextureStorage::texture_set_detect_3d_callback(RID p_texture, RS::TextureDetectCallback p_callback, void *p_userdata) {
 	Texture *texture = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND(!texture);
+	ERR_FAIL_NULL(texture);
 
 	texture->detect_3d_callback = p_callback;
 	texture->detect_3d_callback_ud = p_userdata;
@@ -1140,7 +1140,7 @@ void TextureStorage::texture_set_detect_srgb_callback(RID p_texture, RS::Texture
 
 void TextureStorage::texture_set_detect_normal_callback(RID p_texture, RS::TextureDetectCallback p_callback, void *p_userdata) {
 	Texture *texture = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND(!texture);
+	ERR_FAIL_NULL(texture);
 
 	texture->detect_normal_callback = p_callback;
 	texture->detect_normal_callback_ud = p_userdata;
@@ -1148,7 +1148,7 @@ void TextureStorage::texture_set_detect_normal_callback(RID p_texture, RS::Textu
 
 void TextureStorage::texture_set_detect_roughness_callback(RID p_texture, RS::TextureDetectRoughnessCallback p_callback, void *p_userdata) {
 	Texture *texture = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND(!texture);
+	ERR_FAIL_NULL(texture);
 
 	texture->detect_roughness_callback = p_callback;
 	texture->detect_roughness_callback_ud = p_userdata;
@@ -1176,14 +1176,14 @@ void TextureStorage::texture_debug_usage(List<RS::TextureInfo> *r_info) {
 
 void TextureStorage::texture_set_force_redraw_if_visible(RID p_texture, bool p_enable) {
 	Texture *texture = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND(!texture);
+	ERR_FAIL_NULL(texture);
 
 	texture->redraw_if_visible = p_enable;
 }
 
 Size2 TextureStorage::texture_size_with_proxy(RID p_texture) {
 	const Texture *texture = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND_V(!texture, Size2());
+	ERR_FAIL_NULL_V(texture, Size2());
 	if (texture->is_proxy) {
 		const Texture *proxy = texture_owner.get_or_null(texture->proxy_to);
 		return Size2(proxy->width, proxy->height);
@@ -1201,7 +1201,7 @@ RID TextureStorage::texture_get_rd_texture(RID p_texture, bool p_srgb) const {
 
 uint64_t TextureStorage::texture_get_native_handle(RID p_texture, bool p_srgb) const {
 	const Texture *texture = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND_V(!texture, 0);
+	ERR_FAIL_NULL_V(texture, 0);
 
 	return texture->tex_id;
 }
@@ -1213,7 +1213,7 @@ void TextureStorage::texture_set_data(RID p_texture, const Ref<Image> &p_image,
 void TextureStorage::_texture_set_data(RID p_texture, const Ref<Image> &p_image, int p_layer, bool initialize) {
 	Texture *texture = texture_owner.get_or_null(p_texture);
 
-	ERR_FAIL_COND(!texture);
+	ERR_FAIL_NULL(texture);
 	if (texture->target == GL_TEXTURE_3D) {
 		// Target is set to a 3D texture or array texture, exit early to avoid spamming errors
 		return;
@@ -1346,7 +1346,7 @@ void TextureStorage::_texture_set_data(RID p_texture, const Ref<Image> &p_image,
 Image::Format TextureStorage::texture_get_format(RID p_texture) const {
 	Texture *texture = texture_owner.get_or_null(p_texture);
 
-	ERR_FAIL_COND_V(!texture, Image::FORMAT_L8);
+	ERR_FAIL_NULL_V(texture, Image::FORMAT_L8);
 
 	return texture->format;
 }
@@ -1354,7 +1354,7 @@ Image::Format TextureStorage::texture_get_format(RID p_texture) const {
 uint32_t TextureStorage::texture_get_texid(RID p_texture) const {
 	Texture *texture = texture_owner.get_or_null(p_texture);
 
-	ERR_FAIL_COND_V(!texture, 0);
+	ERR_FAIL_NULL_V(texture, 0);
 
 	return texture->tex_id;
 }
@@ -1362,7 +1362,7 @@ uint32_t TextureStorage::texture_get_texid(RID p_texture) const {
 uint32_t TextureStorage::texture_get_width(RID p_texture) const {
 	Texture *texture = texture_owner.get_or_null(p_texture);
 
-	ERR_FAIL_COND_V(!texture, 0);
+	ERR_FAIL_NULL_V(texture, 0);
 
 	return texture->width;
 }
@@ -1370,7 +1370,7 @@ uint32_t TextureStorage::texture_get_width(RID p_texture) const {
 uint32_t TextureStorage::texture_get_height(RID p_texture) const {
 	Texture *texture = texture_owner.get_or_null(p_texture);
 
-	ERR_FAIL_COND_V(!texture, 0);
+	ERR_FAIL_NULL_V(texture, 0);
 
 	return texture->height;
 }
@@ -1378,7 +1378,7 @@ uint32_t TextureStorage::texture_get_height(RID p_texture) const {
 uint32_t TextureStorage::texture_get_depth(RID p_texture) const {
 	Texture *texture = texture_owner.get_or_null(p_texture);
 
-	ERR_FAIL_COND_V(!texture, 0);
+	ERR_FAIL_NULL_V(texture, 0);
 
 	return texture->depth;
 }
@@ -1386,7 +1386,7 @@ uint32_t TextureStorage::texture_get_depth(RID p_texture) const {
 void TextureStorage::texture_bind(RID p_texture, uint32_t p_texture_no) {
 	Texture *texture = texture_owner.get_or_null(p_texture);
 
-	ERR_FAIL_COND(!texture);
+	ERR_FAIL_NULL(texture);
 
 	glActiveTexture(GL_TEXTURE0 + p_texture_no);
 	glBindTexture(texture->target, texture->tex_id);
@@ -1408,7 +1408,7 @@ void TextureStorage::texture_add_to_texture_atlas(RID p_texture) {
 
 void TextureStorage::texture_remove_from_texture_atlas(RID p_texture) {
 	TextureAtlas::Texture *t = texture_atlas.textures.getptr(p_texture);
-	ERR_FAIL_COND(!t);
+	ERR_FAIL_NULL(t);
 	t->users--;
 	if (t->users == 0) {
 		texture_atlas.textures.erase(p_texture);
@@ -1684,13 +1684,13 @@ void TextureStorage::_update_render_target(RenderTarget *rt) {
 		// color
 		if (rt->overridden.color.is_valid()) {
 			texture = get_texture(rt->overridden.color);
-			ERR_FAIL_COND(!texture);
+			ERR_FAIL_NULL(texture);
 
 			rt->color = texture->tex_id;
 			rt->size = Size2i(texture->width, texture->height);
 		} else {
 			texture = get_texture(rt->texture);
-			ERR_FAIL_COND(!texture);
+			ERR_FAIL_NULL(texture);
 
 			glGenTextures(1, &rt->color);
 			glBindTexture(texture_target, rt->color);
@@ -1719,7 +1719,7 @@ void TextureStorage::_update_render_target(RenderTarget *rt) {
 		// depth
 		if (rt->overridden.depth.is_valid()) {
 			texture = get_texture(rt->overridden.depth);
-			ERR_FAIL_COND(!texture);
+			ERR_FAIL_NULL(texture);
 
 			rt->depth = texture->tex_id;
 		} else {
@@ -2021,21 +2021,21 @@ void TextureStorage::render_target_free(RID p_rid) {
 
 void TextureStorage::render_target_set_position(RID p_render_target, int p_x, int p_y) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND(!rt);
+	ERR_FAIL_NULL(rt);
 
 	rt->position = Point2i(p_x, p_y);
 }
 
 Point2i TextureStorage::render_target_get_position(RID p_render_target) const {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND_V(!rt, Point2i());
+	ERR_FAIL_NULL_V(rt, Point2i());
 
 	return rt->position;
 };
 
 void TextureStorage::render_target_set_size(RID p_render_target, int p_width, int p_height, uint32_t p_view_count) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND(!rt);
+	ERR_FAIL_NULL(rt);
 
 	if (p_width == rt->size.x && p_height == rt->size.y && p_view_count == rt->view_count) {
 		return;
@@ -2055,14 +2055,14 @@ void TextureStorage::render_target_set_size(RID p_render_target, int p_width, in
 // TODO: convert to Size2i internally
 Size2i TextureStorage::render_target_get_size(RID p_render_target) const {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND_V(!rt, Size2i());
+	ERR_FAIL_NULL_V(rt, Size2i());
 
 	return rt->size;
 }
 
 void TextureStorage::render_target_set_override(RID p_render_target, RID p_color_texture, RID p_depth_texture, RID p_velocity_texture) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND(!rt);
+	ERR_FAIL_NULL(rt);
 	ERR_FAIL_COND(rt->direct_to_screen);
 
 	rt->overridden.velocity = p_velocity_texture;
@@ -2118,28 +2118,28 @@ void TextureStorage::render_target_set_override(RID p_render_target, RID p_color
 
 RID TextureStorage::render_target_get_override_color(RID p_render_target) const {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND_V(!rt, RID());
+	ERR_FAIL_NULL_V(rt, RID());
 
 	return rt->overridden.color;
 }
 
 RID TextureStorage::render_target_get_override_depth(RID p_render_target) const {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND_V(!rt, RID());
+	ERR_FAIL_NULL_V(rt, RID());
 
 	return rt->overridden.depth;
 }
 
 RID TextureStorage::render_target_get_override_velocity(RID p_render_target) const {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND_V(!rt, RID());
+	ERR_FAIL_NULL_V(rt, RID());
 
 	return rt->overridden.velocity;
 }
 
 RID TextureStorage::render_target_get_texture(RID p_render_target) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND_V(!rt, RID());
+	ERR_FAIL_NULL_V(rt, RID());
 
 	if (rt->overridden.color.is_valid()) {
 		return rt->overridden.color;
@@ -2150,7 +2150,7 @@ RID TextureStorage::render_target_get_texture(RID p_render_target) {
 
 void TextureStorage::render_target_set_transparent(RID p_render_target, bool p_transparent) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND(!rt);
+	ERR_FAIL_NULL(rt);
 
 	rt->is_transparent = p_transparent;
 
@@ -2162,14 +2162,14 @@ void TextureStorage::render_target_set_transparent(RID p_render_target, bool p_t
 
 bool TextureStorage::render_target_get_transparent(RID p_render_target) const {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND_V(!rt, false);
+	ERR_FAIL_NULL_V(rt, false);
 
 	return rt->is_transparent;
 }
 
 void TextureStorage::render_target_set_direct_to_screen(RID p_render_target, bool p_direct_to_screen) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND(!rt);
+	ERR_FAIL_NULL(rt);
 
 	if (p_direct_to_screen == rt->direct_to_screen) {
 		return;
@@ -2188,28 +2188,28 @@ void TextureStorage::render_target_set_direct_to_screen(RID p_render_target, boo
 
 bool TextureStorage::render_target_get_direct_to_screen(RID p_render_target) const {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND_V(!rt, false);
+	ERR_FAIL_NULL_V(rt, false);
 
 	return rt->direct_to_screen;
 }
 
 bool TextureStorage::render_target_was_used(RID p_render_target) const {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND_V(!rt, false);
+	ERR_FAIL_NULL_V(rt, false);
 
 	return rt->used_in_frame;
 }
 
 void TextureStorage::render_target_clear_used(RID p_render_target) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND(!rt);
+	ERR_FAIL_NULL(rt);
 
 	rt->used_in_frame = false;
 }
 
 void TextureStorage::render_target_set_msaa(RID p_render_target, RS::ViewportMSAA p_msaa) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND(!rt);
+	ERR_FAIL_NULL(rt);
 	if (p_msaa == rt->msaa) {
 		return;
 	}
@@ -2223,38 +2223,38 @@ void TextureStorage::render_target_set_msaa(RID p_render_target, RS::ViewportMSA
 
 RS::ViewportMSAA TextureStorage::render_target_get_msaa(RID p_render_target) const {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND_V(!rt, RS::VIEWPORT_MSAA_DISABLED);
+	ERR_FAIL_NULL_V(rt, RS::VIEWPORT_MSAA_DISABLED);
 
 	return rt->msaa;
 }
 
 void TextureStorage::render_target_request_clear(RID p_render_target, const Color &p_clear_color) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND(!rt);
+	ERR_FAIL_NULL(rt);
 	rt->clear_requested = true;
 	rt->clear_color = p_clear_color;
 }
 
 bool TextureStorage::render_target_is_clear_requested(RID p_render_target) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND_V(!rt, false);
+	ERR_FAIL_NULL_V(rt, false);
 	return rt->clear_requested;
 }
 Color TextureStorage::render_target_get_clear_request_color(RID p_render_target) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND_V(!rt, Color());
+	ERR_FAIL_NULL_V(rt, Color());
 	return rt->clear_color;
 }
 
 void TextureStorage::render_target_disable_clear_request(RID p_render_target) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND(!rt);
+	ERR_FAIL_NULL(rt);
 	rt->clear_requested = false;
 }
 
 void TextureStorage::render_target_do_clear_request(RID p_render_target) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND(!rt);
+	ERR_FAIL_NULL(rt);
 	if (!rt->clear_requested) {
 		return;
 	}
@@ -2267,7 +2267,7 @@ void TextureStorage::render_target_do_clear_request(RID p_render_target) {
 
 void TextureStorage::render_target_set_sdf_size_and_scale(RID p_render_target, RS::ViewportSDFOversize p_size, RS::ViewportSDFScale p_scale) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND(!rt);
+	ERR_FAIL_NULL(rt);
 	if (rt->sdf_oversize == p_size && rt->sdf_scale == p_scale) {
 		return;
 	}
@@ -2309,28 +2309,28 @@ Rect2i TextureStorage::_render_target_get_sdf_rect(const RenderTarget *rt) const
 
 Rect2i TextureStorage::render_target_get_sdf_rect(RID p_render_target) const {
 	const RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND_V(!rt, Rect2i());
+	ERR_FAIL_NULL_V(rt, Rect2i());
 
 	return _render_target_get_sdf_rect(rt);
 }
 
 void TextureStorage::render_target_mark_sdf_enabled(RID p_render_target, bool p_enabled) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND(!rt);
+	ERR_FAIL_NULL(rt);
 
 	rt->sdf_enabled = p_enabled;
 }
 
 bool TextureStorage::render_target_is_sdf_enabled(RID p_render_target) const {
 	const RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND_V(!rt, false);
+	ERR_FAIL_NULL_V(rt, false);
 
 	return rt->sdf_enabled;
 }
 
 GLuint TextureStorage::render_target_get_sdf_texture(RID p_render_target) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND_V(!rt, 0);
+	ERR_FAIL_NULL_V(rt, 0);
 	if (rt->sdf_texture_read == 0) {
 		Texture *texture = texture_owner.get_or_null(default_gl_textures[DEFAULT_GL_TEXTURE_BLACK]);
 		return texture->tex_id;
@@ -2431,7 +2431,7 @@ void TextureStorage::_render_target_clear_sdf(RenderTarget *rt) {
 
 GLuint TextureStorage::render_target_get_sdf_framebuffer(RID p_render_target) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND_V(!rt, 0);
+	ERR_FAIL_NULL_V(rt, 0);
 
 	if (rt->sdf_texture_write_fb == 0) {
 		_render_target_allocate_sdf(rt);
@@ -2443,7 +2443,7 @@ void TextureStorage::render_target_sdf_process(RID p_render_target) {
 	CopyEffects *copy_effects = CopyEffects::get_singleton();
 
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND(!rt);
+	ERR_FAIL_NULL(rt);
 	ERR_FAIL_COND(rt->sdf_texture_write_fb == 0);
 
 	Rect2i r = _render_target_get_sdf_rect(rt);
@@ -2553,7 +2553,7 @@ void TextureStorage::render_target_sdf_process(RID p_render_target) {
 
 void TextureStorage::render_target_copy_to_back_buffer(RID p_render_target, const Rect2i &p_region, bool p_gen_mipmaps) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND(!rt);
+	ERR_FAIL_NULL(rt);
 	ERR_FAIL_COND(rt->direct_to_screen);
 
 	if (rt->backbuffer_fbo == 0) {
@@ -2587,7 +2587,7 @@ void TextureStorage::render_target_copy_to_back_buffer(RID p_render_target, cons
 
 void TextureStorage::render_target_clear_back_buffer(RID p_render_target, const Rect2i &p_region, const Color &p_color) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND(!rt);
+	ERR_FAIL_NULL(rt);
 	ERR_FAIL_COND(rt->direct_to_screen);
 
 	if (rt->backbuffer_fbo == 0) {
@@ -2612,7 +2612,7 @@ void TextureStorage::render_target_clear_back_buffer(RID p_render_target, const
 
 void TextureStorage::render_target_gen_back_buffer_mipmaps(RID p_render_target, const Rect2i &p_region) {
 	RenderTarget *rt = render_target_owner.get_or_null(p_render_target);
-	ERR_FAIL_COND(!rt);
+	ERR_FAIL_NULL(rt);
 
 	if (rt->backbuffer_fbo == 0) {
 		_create_render_target_backbuffer(rt);

+ 3 - 3
drivers/pulseaudio/audio_driver_pulseaudio.cpp

@@ -107,7 +107,7 @@ void AudioDriverPulseAudio::pa_source_info_cb(pa_context *c, const pa_source_inf
 }
 
 void AudioDriverPulseAudio::pa_server_info_cb(pa_context *c, const pa_server_info *i, void *userdata) {
-	ERR_FAIL_COND_MSG(!i, "PulseAudio server info is null.");
+	ERR_FAIL_NULL_MSG(i, "PulseAudio server info is null.");
 	AudioDriverPulseAudio *ad = static_cast<AudioDriverPulseAudio *>(userdata);
 
 	ad->default_input_device = i->default_source_name;
@@ -308,7 +308,7 @@ Error AudioDriverPulseAudio::init() {
 	mix_rate = _get_configured_mix_rate();
 
 	pa_ml = pa_mainloop_new();
-	ERR_FAIL_COND_V(pa_ml == nullptr, ERR_CANT_OPEN);
+	ERR_FAIL_NULL_V(pa_ml, ERR_CANT_OPEN);
 
 	String context_name;
 	if (Engine::get_singleton()->is_editor_hint()) {
@@ -321,7 +321,7 @@ Error AudioDriverPulseAudio::init() {
 	}
 
 	pa_ctx = pa_context_new(pa_mainloop_get_api(pa_ml), context_name.utf8().ptr());
-	ERR_FAIL_COND_V(pa_ctx == nullptr, ERR_CANT_OPEN);
+	ERR_FAIL_NULL_V(pa_ctx, ERR_CANT_OPEN);
 
 	pa_ready = 0;
 	pa_context_set_state_callback(pa_ctx, pa_state_cb, (void *)this);

+ 10 - 10
drivers/unix/file_access_unix.cpp

@@ -53,7 +53,7 @@
 #endif
 
 void FileAccessUnix::check_errors() const {
-	ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
+	ERR_FAIL_NULL_MSG(f, "File must be opened before use.");
 
 	if (feof(f)) {
 		last_error = ERR_FILE_EOF;
@@ -185,7 +185,7 @@ String FileAccessUnix::get_path_absolute() const {
 }
 
 void FileAccessUnix::seek(uint64_t p_position) {
-	ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
+	ERR_FAIL_NULL_MSG(f, "File must be opened before use.");
 
 	last_error = OK;
 	if (fseeko(f, p_position, SEEK_SET)) {
@@ -194,7 +194,7 @@ void FileAccessUnix::seek(uint64_t p_position) {
 }
 
 void FileAccessUnix::seek_end(int64_t p_position) {
-	ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
+	ERR_FAIL_NULL_MSG(f, "File must be opened before use.");
 
 	if (fseeko(f, p_position, SEEK_END)) {
 		check_errors();
@@ -202,7 +202,7 @@ void FileAccessUnix::seek_end(int64_t p_position) {
 }
 
 uint64_t FileAccessUnix::get_position() const {
-	ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use.");
+	ERR_FAIL_NULL_V_MSG(f, 0, "File must be opened before use.");
 
 	int64_t pos = ftello(f);
 	if (pos < 0) {
@@ -213,7 +213,7 @@ uint64_t FileAccessUnix::get_position() const {
 }
 
 uint64_t FileAccessUnix::get_length() const {
-	ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use.");
+	ERR_FAIL_NULL_V_MSG(f, 0, "File must be opened before use.");
 
 	int64_t pos = ftello(f);
 	ERR_FAIL_COND_V(pos < 0, 0);
@@ -230,7 +230,7 @@ bool FileAccessUnix::eof_reached() const {
 }
 
 uint8_t FileAccessUnix::get_8() const {
-	ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use.");
+	ERR_FAIL_NULL_V_MSG(f, 0, "File must be opened before use.");
 	uint8_t b;
 	if (fread(&b, 1, 1, f) == 0) {
 		check_errors();
@@ -241,7 +241,7 @@ uint8_t FileAccessUnix::get_8() const {
 
 uint64_t FileAccessUnix::get_buffer(uint8_t *p_dst, uint64_t p_length) const {
 	ERR_FAIL_COND_V(!p_dst && p_length > 0, -1);
-	ERR_FAIL_COND_V_MSG(!f, -1, "File must be opened before use.");
+	ERR_FAIL_NULL_V_MSG(f, -1, "File must be opened before use.");
 
 	uint64_t read = fread(p_dst, 1, p_length, f);
 	check_errors();
@@ -253,17 +253,17 @@ Error FileAccessUnix::get_error() const {
 }
 
 void FileAccessUnix::flush() {
-	ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
+	ERR_FAIL_NULL_MSG(f, "File must be opened before use.");
 	fflush(f);
 }
 
 void FileAccessUnix::store_8(uint8_t p_dest) {
-	ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
+	ERR_FAIL_NULL_MSG(f, "File must be opened before use.");
 	ERR_FAIL_COND(fwrite(&p_dest, 1, 1, f) != 1);
 }
 
 void FileAccessUnix::store_buffer(const uint8_t *p_src, uint64_t p_length) {
-	ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
+	ERR_FAIL_NULL_MSG(f, "File must be opened before use.");
 	ERR_FAIL_COND(!p_src && p_length > 0);
 	ERR_FAIL_COND(fwrite(p_src, 1, p_length, f) != p_length);
 }

+ 2 - 2
drivers/unix/os_unix.cpp

@@ -495,7 +495,7 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, St
 		}
 
 		FILE *f = popen(command.utf8().get_data(), "r");
-		ERR_FAIL_COND_V_MSG(!f, ERR_CANT_OPEN, "Cannot create pipe from command: " + command);
+		ERR_FAIL_NULL_V_MSG(f, ERR_CANT_OPEN, "Cannot create pipe from command: " + command + ".");
 		char buf[65535];
 		while (fgets(buf, 65535, f)) {
 			if (p_pipe_mutex) {
@@ -647,7 +647,7 @@ Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle
 	}
 
 	p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW);
-	ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, vformat("Can't open dynamic library: %s. Error: %s.", p_path, dlerror()));
+	ERR_FAIL_NULL_V_MSG(p_library_handle, ERR_CANT_OPEN, vformat("Can't open dynamic library: %s. Error: %s.", p_path, dlerror()));
 
 	if (r_resolved_path != nullptr) {
 		*r_resolved_path = path;

+ 67 - 67
drivers/vulkan/rendering_device_vulkan.cpp

@@ -2038,12 +2038,12 @@ RID RenderingDeviceVulkan::texture_create_shared(const TextureView &p_view, RID
 	_THREAD_SAFE_METHOD_
 
 	Texture *src_texture = texture_owner.get_or_null(p_with_texture);
-	ERR_FAIL_COND_V(!src_texture, RID());
+	ERR_FAIL_NULL_V(src_texture, RID());
 
 	if (src_texture->owner.is_valid()) { // Ahh this is a share.
 		p_with_texture = src_texture->owner;
 		src_texture = texture_owner.get_or_null(src_texture->owner);
-		ERR_FAIL_COND_V(!src_texture, RID()); // This is a bug.
+		ERR_FAIL_NULL_V(src_texture, RID()); // This is a bug.
 	}
 
 	// Create view.
@@ -2313,12 +2313,12 @@ RID RenderingDeviceVulkan::texture_create_shared_from_slice(const TextureView &p
 	_THREAD_SAFE_METHOD_
 
 	Texture *src_texture = texture_owner.get_or_null(p_with_texture);
-	ERR_FAIL_COND_V(!src_texture, RID());
+	ERR_FAIL_NULL_V(src_texture, RID());
 
 	if (src_texture->owner.is_valid()) { // Ahh this is a share.
 		p_with_texture = src_texture->owner;
 		src_texture = texture_owner.get_or_null(src_texture->owner);
-		ERR_FAIL_COND_V(!src_texture, RID()); // This is a bug.
+		ERR_FAIL_NULL_V(src_texture, RID()); // This is a bug.
 	}
 
 	ERR_FAIL_COND_V_MSG(p_slice_type == TEXTURE_SLICE_CUBEMAP && (src_texture->type != TEXTURE_TYPE_CUBE && src_texture->type != TEXTURE_TYPE_CUBE_ARRAY), RID(),
@@ -2469,12 +2469,12 @@ Error RenderingDeviceVulkan::_texture_update(RID p_texture, uint32_t p_layer, co
 			"Updating textures is forbidden during creation of a draw or compute list");
 
 	Texture *texture = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND_V(!texture, ERR_INVALID_PARAMETER);
+	ERR_FAIL_NULL_V(texture, ERR_INVALID_PARAMETER);
 
 	if (texture->owner != RID()) {
 		p_texture = texture->owner;
 		texture = texture_owner.get_or_null(texture->owner);
-		ERR_FAIL_COND_V(!texture, ERR_BUG); // This is a bug.
+		ERR_FAIL_NULL_V(texture, ERR_BUG); // This is a bug.
 	}
 
 	ERR_FAIL_COND_V_MSG(texture->bound, ERR_CANT_ACQUIRE_RESOURCE,
@@ -2755,7 +2755,7 @@ Vector<uint8_t> RenderingDeviceVulkan::texture_get_data(RID p_texture, uint32_t
 	_THREAD_SAFE_METHOD_
 
 	Texture *tex = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND_V(!tex, Vector<uint8_t>());
+	ERR_FAIL_NULL_V(tex, Vector<uint8_t>());
 
 	ERR_FAIL_COND_V_MSG(tex->bound, Vector<uint8_t>(),
 			"Texture can't be retrieved while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to `RenderingDevice.FINAL_ACTION_CONTINUE`) to retrieve this texture.");
@@ -2885,7 +2885,7 @@ bool RenderingDeviceVulkan::texture_is_shared(RID p_texture) {
 	_THREAD_SAFE_METHOD_
 
 	Texture *tex = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND_V(!tex, false);
+	ERR_FAIL_NULL_V(tex, false);
 	return tex->owner.is_valid();
 }
 
@@ -2897,7 +2897,7 @@ RD::TextureFormat RenderingDeviceVulkan::texture_get_format(RID p_texture) {
 	_THREAD_SAFE_METHOD_
 
 	Texture *tex = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND_V(!tex, TextureFormat());
+	ERR_FAIL_NULL_V(tex, TextureFormat());
 
 	TextureFormat tf;
 
@@ -2920,7 +2920,7 @@ Size2i RenderingDeviceVulkan::texture_size(RID p_texture) {
 	_THREAD_SAFE_METHOD_
 
 	Texture *tex = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND_V(!tex, Size2i());
+	ERR_FAIL_NULL_V(tex, Size2i());
 	return Size2i(tex->width, tex->height);
 }
 
@@ -2928,7 +2928,7 @@ uint64_t RenderingDeviceVulkan::texture_get_native_handle(RID p_texture) {
 	_THREAD_SAFE_METHOD_
 
 	Texture *tex = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND_V(!tex, 0);
+	ERR_FAIL_NULL_V(tex, 0);
 
 	return (uint64_t)tex->image;
 }
@@ -2937,7 +2937,7 @@ Error RenderingDeviceVulkan::texture_copy(RID p_from_texture, RID p_to_texture,
 	_THREAD_SAFE_METHOD_
 
 	Texture *src_tex = texture_owner.get_or_null(p_from_texture);
-	ERR_FAIL_COND_V(!src_tex, ERR_INVALID_PARAMETER);
+	ERR_FAIL_NULL_V(src_tex, ERR_INVALID_PARAMETER);
 
 	ERR_FAIL_COND_V_MSG(src_tex->bound, ERR_INVALID_PARAMETER,
 			"Source texture can't be copied while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to `RenderingDevice.FINAL_ACTION_CONTINUE`) to copy this texture.");
@@ -2958,7 +2958,7 @@ Error RenderingDeviceVulkan::texture_copy(RID p_from_texture, RID p_to_texture,
 	ERR_FAIL_COND_V(p_src_layer >= src_layer_count, ERR_INVALID_PARAMETER);
 
 	Texture *dst_tex = texture_owner.get_or_null(p_to_texture);
-	ERR_FAIL_COND_V(!dst_tex, ERR_INVALID_PARAMETER);
+	ERR_FAIL_NULL_V(dst_tex, ERR_INVALID_PARAMETER);
 
 	ERR_FAIL_COND_V_MSG(dst_tex->bound, ERR_INVALID_PARAMETER,
 			"Destination texture can't be copied while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to `RenderingDevice.FINAL_ACTION_CONTINUE`) to copy this texture.");
@@ -3136,7 +3136,7 @@ Error RenderingDeviceVulkan::texture_resolve_multisample(RID p_from_texture, RID
 	_THREAD_SAFE_METHOD_
 
 	Texture *src_tex = texture_owner.get_or_null(p_from_texture);
-	ERR_FAIL_COND_V(!src_tex, ERR_INVALID_PARAMETER);
+	ERR_FAIL_NULL_V(src_tex, ERR_INVALID_PARAMETER);
 
 	ERR_FAIL_COND_V_MSG(src_tex->bound, ERR_INVALID_PARAMETER,
 			"Source texture can't be copied while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to `RenderingDevice.FINAL_ACTION_CONTINUE`) to copy this texture.");
@@ -3147,7 +3147,7 @@ Error RenderingDeviceVulkan::texture_resolve_multisample(RID p_from_texture, RID
 	ERR_FAIL_COND_V_MSG(src_tex->samples == TEXTURE_SAMPLES_1, ERR_INVALID_PARAMETER, "Source texture must be multisampled.");
 
 	Texture *dst_tex = texture_owner.get_or_null(p_to_texture);
-	ERR_FAIL_COND_V(!dst_tex, ERR_INVALID_PARAMETER);
+	ERR_FAIL_NULL_V(dst_tex, ERR_INVALID_PARAMETER);
 
 	ERR_FAIL_COND_V_MSG(dst_tex->bound, ERR_INVALID_PARAMETER,
 			"Destination texture can't be copied while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to `RenderingDevice.FINAL_ACTION_CONTINUE`) to copy this texture.");
@@ -3311,7 +3311,7 @@ Error RenderingDeviceVulkan::texture_clear(RID p_texture, const Color &p_color,
 	_THREAD_SAFE_METHOD_
 
 	Texture *src_tex = texture_owner.get_or_null(p_texture);
-	ERR_FAIL_COND_V(!src_tex, ERR_INVALID_PARAMETER);
+	ERR_FAIL_NULL_V(src_tex, ERR_INVALID_PARAMETER);
 
 	ERR_FAIL_COND_V_MSG(src_tex->bound, ERR_INVALID_PARAMETER,
 			"Source texture can't be cleared while a draw list that uses it as part of a framebuffer is being created. Ensure the draw list is finalized (and that the color/depth texture using it is not set to `RenderingDevice.FINAL_ACTION_CONTINUE`) to clear this texture.");
@@ -4299,7 +4299,7 @@ RenderingDevice::FramebufferFormatID RenderingDeviceVulkan::framebuffer_get_form
 	_THREAD_SAFE_METHOD_
 
 	Framebuffer *framebuffer = framebuffer_owner.get_or_null(p_framebuffer);
-	ERR_FAIL_COND_V(!framebuffer, INVALID_ID);
+	ERR_FAIL_NULL_V(framebuffer, INVALID_ID);
 
 	return framebuffer->format_id;
 }
@@ -4314,7 +4314,7 @@ void RenderingDeviceVulkan::framebuffer_set_invalidation_callback(RID p_framebuf
 	_THREAD_SAFE_METHOD_
 
 	Framebuffer *framebuffer = framebuffer_owner.get_or_null(p_framebuffer);
-	ERR_FAIL_COND(!framebuffer);
+	ERR_FAIL_NULL(framebuffer);
 
 	framebuffer->invalidated_callback = p_callback;
 	framebuffer->invalidated_callback_userdata = p_userdata;
@@ -4619,7 +4619,7 @@ static VkShaderStageFlagBits shader_stage_masks[RenderingDevice::SHADER_STAGE_MA
 String RenderingDeviceVulkan::_shader_uniform_debug(RID p_shader, int p_set) {
 	String ret;
 	const Shader *shader = shader_owner.get_or_null(p_shader);
-	ERR_FAIL_COND_V(!shader, String());
+	ERR_FAIL_NULL_V(shader, String());
 	for (int i = 0; i < shader->sets.size(); i++) {
 		if (p_set >= 0 && i != p_set) {
 			continue;
@@ -5212,7 +5212,7 @@ uint32_t RenderingDeviceVulkan::shader_get_vertex_input_attribute_mask(RID p_sha
 	_THREAD_SAFE_METHOD_
 
 	const Shader *shader = shader_owner.get_or_null(p_shader);
-	ERR_FAIL_COND_V(!shader, 0);
+	ERR_FAIL_NULL_V(shader, 0);
 	return shader->vertex_input_mask;
 }
 
@@ -5429,7 +5429,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
 	ERR_FAIL_COND_V(p_uniforms.size() == 0, RID());
 
 	Shader *shader = shader_owner.get_or_null(p_shader);
-	ERR_FAIL_COND_V(!shader, RID());
+	ERR_FAIL_NULL_V(shader, RID());
 
 	ERR_FAIL_COND_V_MSG(p_shader_set >= (uint32_t)shader->sets.size() || shader->sets[p_shader_set].uniform_info.size() == 0, RID(),
 			"Desired set (" + itos(p_shader_set) + ") not used by shader.");
@@ -5498,7 +5498,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
 
 				for (uint32_t j = 0; j < uniform.get_id_count(); j++) {
 					VkSampler *sampler = sampler_owner.get_or_null(uniform.get_id(j));
-					ERR_FAIL_COND_V_MSG(!sampler, RID(), "Sampler (binding: " + itos(uniform.binding) + ", index " + itos(j) + ") is not a valid sampler.");
+					ERR_FAIL_NULL_V_MSG(sampler, RID(), "Sampler (binding: " + itos(uniform.binding) + ", index " + itos(j) + ") is not a valid sampler.");
 
 					VkDescriptorImageInfo img_info;
 					img_info.sampler = *sampler;
@@ -5531,10 +5531,10 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
 
 				for (uint32_t j = 0; j < uniform.get_id_count(); j += 2) {
 					VkSampler *sampler = sampler_owner.get_or_null(uniform.get_id(j + 0));
-					ERR_FAIL_COND_V_MSG(!sampler, RID(), "SamplerBuffer (binding: " + itos(uniform.binding) + ", index " + itos(j + 1) + ") is not a valid sampler.");
+					ERR_FAIL_NULL_V_MSG(sampler, RID(), "SamplerBuffer (binding: " + itos(uniform.binding) + ", index " + itos(j + 1) + ") is not a valid sampler.");
 
 					Texture *texture = texture_owner.get_or_null(uniform.get_id(j + 1));
-					ERR_FAIL_COND_V_MSG(!texture, RID(), "Texture (binding: " + itos(uniform.binding) + ", index " + itos(j) + ") is not a valid texture.");
+					ERR_FAIL_NULL_V_MSG(texture, RID(), "Texture (binding: " + itos(uniform.binding) + ", index " + itos(j) + ") is not a valid texture.");
 
 					ERR_FAIL_COND_V_MSG(!(texture->usage_flags & TEXTURE_USAGE_SAMPLING_BIT), RID(),
 							"Texture (binding: " + itos(uniform.binding) + ", index " + itos(j) + ") needs the TEXTURE_USAGE_SAMPLING_BIT usage flag set in order to be used as uniform.");
@@ -5585,7 +5585,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
 
 				for (uint32_t j = 0; j < uniform.get_id_count(); j++) {
 					Texture *texture = texture_owner.get_or_null(uniform.get_id(j));
-					ERR_FAIL_COND_V_MSG(!texture, RID(), "Texture (binding: " + itos(uniform.binding) + ", index " + itos(j) + ") is not a valid texture.");
+					ERR_FAIL_NULL_V_MSG(texture, RID(), "Texture (binding: " + itos(uniform.binding) + ", index " + itos(j) + ") is not a valid texture.");
 
 					ERR_FAIL_COND_V_MSG(!(texture->usage_flags & TEXTURE_USAGE_SAMPLING_BIT), RID(),
 							"Texture (binding: " + itos(uniform.binding) + ", index " + itos(j) + ") needs the TEXTURE_USAGE_SAMPLING_BIT usage flag set in order to be used as uniform.");
@@ -5636,7 +5636,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
 				for (uint32_t j = 0; j < uniform.get_id_count(); j++) {
 					Texture *texture = texture_owner.get_or_null(uniform.get_id(j));
 
-					ERR_FAIL_COND_V_MSG(!texture, RID(),
+					ERR_FAIL_NULL_V_MSG(texture, RID(),
 							"Image (binding: " + itos(uniform.binding) + ", index " + itos(j) + ") is not a valid texture.");
 
 					ERR_FAIL_COND_V_MSG(!(texture->usage_flags & TEXTURE_USAGE_STORAGE_BIT), RID(),
@@ -5682,7 +5682,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
 
 				for (uint32_t j = 0; j < uniform.get_id_count(); j++) {
 					TextureBuffer *buffer = texture_buffer_owner.get_or_null(uniform.get_id(j));
-					ERR_FAIL_COND_V_MSG(!buffer, RID(), "Texture Buffer (binding: " + itos(uniform.binding) + ", index " + itos(j) + ") is not a valid texture buffer.");
+					ERR_FAIL_NULL_V_MSG(buffer, RID(), "Texture Buffer (binding: " + itos(uniform.binding) + ", index " + itos(j) + ") is not a valid texture buffer.");
 
 					buffer_info.push_back(buffer->buffer.buffer_info);
 					buffer_view.push_back(buffer->view);
@@ -5713,7 +5713,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
 
 				for (uint32_t j = 0; j < uniform.get_id_count(); j += 2) {
 					VkSampler *sampler = sampler_owner.get_or_null(uniform.get_id(j + 0));
-					ERR_FAIL_COND_V_MSG(!sampler, RID(), "SamplerBuffer (binding: " + itos(uniform.binding) + ", index " + itos(j + 1) + ") is not a valid sampler.");
+					ERR_FAIL_NULL_V_MSG(sampler, RID(), "SamplerBuffer (binding: " + itos(uniform.binding) + ", index " + itos(j + 1) + ") is not a valid sampler.");
 
 					TextureBuffer *buffer = texture_buffer_owner.get_or_null(uniform.get_id(j + 1));
 
@@ -5724,7 +5724,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
 
 					image_info.push_back(img_info);
 
-					ERR_FAIL_COND_V_MSG(!buffer, RID(), "SamplerBuffer (binding: " + itos(uniform.binding) + ", index " + itos(j + 1) + ") is not a valid texture buffer.");
+					ERR_FAIL_NULL_V_MSG(buffer, RID(), "SamplerBuffer (binding: " + itos(uniform.binding) + ", index " + itos(j + 1) + ") is not a valid texture buffer.");
 
 					buffer_info.push_back(buffer->buffer.buffer_info);
 					buffer_view.push_back(buffer->view);
@@ -5748,7 +5748,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
 						"Uniform buffer supplied (binding: " + itos(uniform.binding) + ") must provide one ID (" + itos(uniform.get_id_count()) + " provided).");
 
 				Buffer *buffer = uniform_buffer_owner.get_or_null(uniform.get_id(0));
-				ERR_FAIL_COND_V_MSG(!buffer, RID(), "Uniform buffer supplied (binding: " + itos(uniform.binding) + ") is invalid.");
+				ERR_FAIL_NULL_V_MSG(buffer, RID(), "Uniform buffer supplied (binding: " + itos(uniform.binding) + ") is invalid.");
 
 				ERR_FAIL_COND_V_MSG(buffer->size != (uint32_t)set_uniform.length, RID(),
 						"Uniform buffer supplied (binding: " + itos(uniform.binding) + ") size (" + itos(buffer->size) + " does not match size of shader uniform: (" + itos(set_uniform.length) + ").");
@@ -5774,7 +5774,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
 
 					ERR_FAIL_COND_V_MSG(!(buffer->usage & VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), RID(), "Vertex buffer supplied (binding: " + itos(uniform.binding) + ") was not created with storage flag.");
 				}
-				ERR_FAIL_COND_V_MSG(!buffer, RID(), "Storage buffer supplied (binding: " + itos(uniform.binding) + ") is invalid.");
+				ERR_FAIL_NULL_V_MSG(buffer, RID(), "Storage buffer supplied (binding: " + itos(uniform.binding) + ") is invalid.");
 
 				// If 0, then it's sized on link time.
 				ERR_FAIL_COND_V_MSG(set_uniform.length > 0 && buffer->size != (uint32_t)set_uniform.length, RID(),
@@ -5803,7 +5803,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
 				for (uint32_t j = 0; j < uniform.get_id_count(); j++) {
 					Texture *texture = texture_owner.get_or_null(uniform.get_id(j));
 
-					ERR_FAIL_COND_V_MSG(!texture, RID(),
+					ERR_FAIL_NULL_V_MSG(texture, RID(),
 							"InputAttachment (binding: " + itos(uniform.binding) + ", index " + itos(j) + ") is not a valid texture.");
 
 					ERR_FAIL_COND_V_MSG(!(texture->usage_flags & TEXTURE_USAGE_SAMPLING_BIT), RID(),
@@ -5843,7 +5843,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
 	// Need a descriptor pool.
 	DescriptorPool *pool = _descriptor_pool_allocate(pool_key);
 
-	ERR_FAIL_COND_V(!pool, RID());
+	ERR_FAIL_NULL_V(pool, RID());
 
 	VkDescriptorSetAllocateInfo descriptor_set_allocate_info;
 
@@ -5903,7 +5903,7 @@ bool RenderingDeviceVulkan::uniform_set_is_valid(RID p_uniform_set) {
 
 void RenderingDeviceVulkan::uniform_set_set_invalidation_callback(RID p_uniform_set, InvalidationCallback p_callback, void *p_userdata) {
 	UniformSet *us = uniform_set_owner.get_or_null(p_uniform_set);
-	ERR_FAIL_COND(!us);
+	ERR_FAIL_NULL(us);
 	us->invalidated_callback = p_callback;
 	us->invalidated_callback_userdata = p_userdata;
 }
@@ -6118,7 +6118,7 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma
 
 	// Needs a shader.
 	Shader *shader = shader_owner.get_or_null(p_shader);
-	ERR_FAIL_COND_V(!shader, RID());
+	ERR_FAIL_NULL_V(shader, RID());
 
 	ERR_FAIL_COND_V_MSG(shader->is_compute, RID(),
 			"Compute shaders can't be used in render pipelines");
@@ -6590,7 +6590,7 @@ RID RenderingDeviceVulkan::compute_pipeline_create(RID p_shader, const Vector<Pi
 
 	// Needs a shader.
 	Shader *shader = shader_owner.get_or_null(p_shader);
-	ERR_FAIL_COND_V(!shader, RID());
+	ERR_FAIL_NULL_V(shader, RID());
 
 	ERR_FAIL_COND_V_MSG(!shader->is_compute, RID(),
 			"Non-compute shaders can't be used in compute pipelines");
@@ -7004,7 +7004,7 @@ RenderingDevice::DrawListID RenderingDeviceVulkan::draw_list_begin(RID p_framebu
 	ERR_FAIL_COND_V_MSG(compute_list != nullptr && !compute_list->state.allow_draw_overlap, INVALID_ID, "Only one draw/compute list can be active at the same time.");
 
 	Framebuffer *framebuffer = framebuffer_owner.get_or_null(p_framebuffer);
-	ERR_FAIL_COND_V(!framebuffer, INVALID_ID);
+	ERR_FAIL_NULL_V(framebuffer, INVALID_ID);
 
 	Point2i viewport_offset;
 	Point2i viewport_size = framebuffer->size;
@@ -7112,7 +7112,7 @@ Error RenderingDeviceVulkan::draw_list_begin_split(RID p_framebuffer, uint32_t p
 	ERR_FAIL_COND_V(p_splits < 1, ERR_INVALID_DECLARATION);
 
 	Framebuffer *framebuffer = framebuffer_owner.get_or_null(p_framebuffer);
-	ERR_FAIL_COND_V(!framebuffer, ERR_INVALID_DECLARATION);
+	ERR_FAIL_NULL_V(framebuffer, ERR_INVALID_DECLARATION);
 
 	Point2i viewport_offset;
 	Point2i viewport_size = framebuffer->size;
@@ -7242,7 +7242,7 @@ RenderingDeviceVulkan::DrawList *RenderingDeviceVulkan::_get_draw_list_ptr(DrawL
 
 void RenderingDeviceVulkan::draw_list_set_blend_constants(DrawListID p_list, const Color &p_color) {
 	DrawList *dl = _get_draw_list_ptr(p_list);
-	ERR_FAIL_COND(!dl);
+	ERR_FAIL_NULL(dl);
 #ifdef DEBUG_ENABLED
 	ERR_FAIL_COND_MSG(!dl->validation.active, "Submitted Draw Lists can no longer be modified.");
 #endif
@@ -7252,13 +7252,13 @@ void RenderingDeviceVulkan::draw_list_set_blend_constants(DrawListID p_list, con
 
 void RenderingDeviceVulkan::draw_list_bind_render_pipeline(DrawListID p_list, RID p_render_pipeline) {
 	DrawList *dl = _get_draw_list_ptr(p_list);
-	ERR_FAIL_COND(!dl);
+	ERR_FAIL_NULL(dl);
 #ifdef DEBUG_ENABLED
 	ERR_FAIL_COND_MSG(!dl->validation.active, "Submitted Draw Lists can no longer be modified.");
 #endif
 
 	const RenderPipeline *pipeline = render_pipeline_owner.get_or_null(p_render_pipeline);
-	ERR_FAIL_COND(!pipeline);
+	ERR_FAIL_NULL(pipeline);
 #ifdef DEBUG_ENABLED
 	ERR_FAIL_COND(pipeline->validation.framebuffer_format != draw_list_framebuffer_format && pipeline->validation.render_pass != draw_list_current_subpass);
 #endif
@@ -7326,14 +7326,14 @@ void RenderingDeviceVulkan::draw_list_bind_uniform_set(DrawListID p_list, RID p_
 			"Attempting to bind a descriptor set (" + itos(p_index) + ") greater than what the hardware supports (" + itos(limits.maxBoundDescriptorSets) + ").");
 #endif
 	DrawList *dl = _get_draw_list_ptr(p_list);
-	ERR_FAIL_COND(!dl);
+	ERR_FAIL_NULL(dl);
 
 #ifdef DEBUG_ENABLED
 	ERR_FAIL_COND_MSG(!dl->validation.active, "Submitted Draw Lists can no longer be modified.");
 #endif
 
 	const UniformSet *uniform_set = uniform_set_owner.get_or_null(p_uniform_set);
-	ERR_FAIL_COND(!uniform_set);
+	ERR_FAIL_NULL(uniform_set);
 
 	if (p_index > dl->state.set_count) {
 		dl->state.set_count = p_index;
@@ -7375,13 +7375,13 @@ void RenderingDeviceVulkan::draw_list_bind_uniform_set(DrawListID p_list, RID p_
 
 void RenderingDeviceVulkan::draw_list_bind_vertex_array(DrawListID p_list, RID p_vertex_array) {
 	DrawList *dl = _get_draw_list_ptr(p_list);
-	ERR_FAIL_COND(!dl);
+	ERR_FAIL_NULL(dl);
 #ifdef DEBUG_ENABLED
 	ERR_FAIL_COND_MSG(!dl->validation.active, "Submitted Draw Lists can no longer be modified.");
 #endif
 
 	const VertexArray *vertex_array = vertex_array_owner.get_or_null(p_vertex_array);
-	ERR_FAIL_COND(!vertex_array);
+	ERR_FAIL_NULL(vertex_array);
 
 	if (dl->state.vertex_array == p_vertex_array) {
 		return; // Already set.
@@ -7399,13 +7399,13 @@ void RenderingDeviceVulkan::draw_list_bind_vertex_array(DrawListID p_list, RID p
 
 void RenderingDeviceVulkan::draw_list_bind_index_array(DrawListID p_list, RID p_index_array) {
 	DrawList *dl = _get_draw_list_ptr(p_list);
-	ERR_FAIL_COND(!dl);
+	ERR_FAIL_NULL(dl);
 #ifdef DEBUG_ENABLED
 	ERR_FAIL_COND_MSG(!dl->validation.active, "Submitted Draw Lists can no longer be modified.");
 #endif
 
 	const IndexArray *index_array = index_array_owner.get_or_null(p_index_array);
-	ERR_FAIL_COND(!index_array);
+	ERR_FAIL_NULL(index_array);
 
 	if (dl->state.index_array == p_index_array) {
 		return; // Already set.
@@ -7423,7 +7423,7 @@ void RenderingDeviceVulkan::draw_list_bind_index_array(DrawListID p_list, RID p_
 
 void RenderingDeviceVulkan::draw_list_set_line_width(DrawListID p_list, float p_width) {
 	DrawList *dl = _get_draw_list_ptr(p_list);
-	ERR_FAIL_COND(!dl);
+	ERR_FAIL_NULL(dl);
 #ifdef DEBUG_ENABLED
 	ERR_FAIL_COND_MSG(!dl->validation.active, "Submitted Draw Lists can no longer be modified.");
 #endif
@@ -7433,7 +7433,7 @@ void RenderingDeviceVulkan::draw_list_set_line_width(DrawListID p_list, float p_
 
 void RenderingDeviceVulkan::draw_list_set_push_constant(DrawListID p_list, const void *p_data, uint32_t p_data_size) {
 	DrawList *dl = _get_draw_list_ptr(p_list);
-	ERR_FAIL_COND(!dl);
+	ERR_FAIL_NULL(dl);
 
 #ifdef DEBUG_ENABLED
 	ERR_FAIL_COND_MSG(!dl->validation.active, "Submitted Draw Lists can no longer be modified.");
@@ -7451,7 +7451,7 @@ void RenderingDeviceVulkan::draw_list_set_push_constant(DrawListID p_list, const
 
 void RenderingDeviceVulkan::draw_list_draw(DrawListID p_list, bool p_use_indices, uint32_t p_instances, uint32_t p_procedural_vertices) {
 	DrawList *dl = _get_draw_list_ptr(p_list);
-	ERR_FAIL_COND(!dl);
+	ERR_FAIL_NULL(dl);
 #ifdef DEBUG_ENABLED
 	ERR_FAIL_COND_MSG(!dl->validation.active, "Submitted Draw Lists can no longer be modified.");
 #endif
@@ -7557,7 +7557,7 @@ void RenderingDeviceVulkan::draw_list_draw(DrawListID p_list, bool p_use_indices
 void RenderingDeviceVulkan::draw_list_enable_scissor(DrawListID p_list, const Rect2 &p_rect) {
 	DrawList *dl = _get_draw_list_ptr(p_list);
 
-	ERR_FAIL_COND(!dl);
+	ERR_FAIL_NULL(dl);
 #ifdef DEBUG_ENABLED
 	ERR_FAIL_COND_MSG(!dl->validation.active, "Submitted Draw Lists can no longer be modified.");
 #endif
@@ -7580,7 +7580,7 @@ void RenderingDeviceVulkan::draw_list_enable_scissor(DrawListID p_list, const Re
 
 void RenderingDeviceVulkan::draw_list_disable_scissor(DrawListID p_list) {
 	DrawList *dl = _get_draw_list_ptr(p_list);
-	ERR_FAIL_COND(!dl);
+	ERR_FAIL_NULL(dl);
 #ifdef DEBUG_ENABLED
 	ERR_FAIL_COND_MSG(!dl->validation.active, "Submitted Draw Lists can no longer be modified.");
 #endif
@@ -7599,7 +7599,7 @@ uint32_t RenderingDeviceVulkan::draw_list_get_current_pass() {
 
 RenderingDevice::DrawListID RenderingDeviceVulkan::draw_list_switch_to_next_pass() {
 	_THREAD_SAFE_METHOD_
-	ERR_FAIL_COND_V(draw_list == nullptr, INVALID_ID);
+	ERR_FAIL_NULL_V(draw_list, INVALID_ID);
 	ERR_FAIL_COND_V(draw_list_current_subpass >= draw_list_subpass_count - 1, INVALID_FORMAT_ID);
 
 	draw_list_current_subpass++;
@@ -7615,7 +7615,7 @@ RenderingDevice::DrawListID RenderingDeviceVulkan::draw_list_switch_to_next_pass
 }
 Error RenderingDeviceVulkan::draw_list_switch_to_next_pass_split(uint32_t p_splits, DrawListID *r_split_ids) {
 	_THREAD_SAFE_METHOD_
-	ERR_FAIL_COND_V(draw_list == nullptr, ERR_INVALID_PARAMETER);
+	ERR_FAIL_NULL_V(draw_list, ERR_INVALID_PARAMETER);
 	ERR_FAIL_COND_V(draw_list_current_subpass >= draw_list_subpass_count - 1, ERR_INVALID_PARAMETER);
 
 	draw_list_current_subpass++;
@@ -7756,7 +7756,7 @@ void RenderingDeviceVulkan::_draw_list_free(Rect2i *r_last_viewport) {
 void RenderingDeviceVulkan::draw_list_end(BitField<BarrierMask> p_post_barrier) {
 	_THREAD_SAFE_METHOD_
 
-	ERR_FAIL_COND_MSG(!draw_list, "Immediate draw list is already inactive.");
+	ERR_FAIL_NULL_MSG(draw_list, "Immediate draw list is already inactive.");
 
 	_draw_list_free();
 
@@ -7884,12 +7884,12 @@ void RenderingDeviceVulkan::compute_list_bind_compute_pipeline(ComputeListID p_l
 	// Must be called within a compute list, the class mutex is locked during that time
 
 	ERR_FAIL_COND(p_list != ID_TYPE_COMPUTE_LIST);
-	ERR_FAIL_COND(!compute_list);
+	ERR_FAIL_NULL(compute_list);
 
 	ComputeList *cl = compute_list;
 
 	const ComputePipeline *pipeline = compute_pipeline_owner.get_or_null(p_compute_pipeline);
-	ERR_FAIL_COND(!pipeline);
+	ERR_FAIL_NULL(pipeline);
 
 	if (p_compute_pipeline == cl->state.pipeline) {
 		return; // Redundant state, return.
@@ -7950,7 +7950,7 @@ void RenderingDeviceVulkan::compute_list_bind_uniform_set(ComputeListID p_list,
 	// Must be called within a compute list, the class mutex is locked during that time
 
 	ERR_FAIL_COND(p_list != ID_TYPE_COMPUTE_LIST);
-	ERR_FAIL_COND(!compute_list);
+	ERR_FAIL_NULL(compute_list);
 
 	ComputeList *cl = compute_list;
 
@@ -7964,7 +7964,7 @@ void RenderingDeviceVulkan::compute_list_bind_uniform_set(ComputeListID p_list,
 #endif
 
 	UniformSet *uniform_set = uniform_set_owner.get_or_null(p_uniform_set);
-	ERR_FAIL_COND(!uniform_set);
+	ERR_FAIL_NULL(uniform_set);
 
 	if (p_index > cl->state.set_count) {
 		cl->state.set_count = p_index;
@@ -8104,7 +8104,7 @@ void RenderingDeviceVulkan::compute_list_bind_uniform_set(ComputeListID p_list,
 
 void RenderingDeviceVulkan::compute_list_set_push_constant(ComputeListID p_list, const void *p_data, uint32_t p_data_size) {
 	ERR_FAIL_COND(p_list != ID_TYPE_COMPUTE_LIST);
-	ERR_FAIL_COND(!compute_list);
+	ERR_FAIL_NULL(compute_list);
 
 	ComputeList *cl = compute_list;
 
@@ -8126,7 +8126,7 @@ void RenderingDeviceVulkan::compute_list_dispatch(ComputeListID p_list, uint32_t
 	// Must be called within a compute list, the class mutex is locked during that time
 
 	ERR_FAIL_COND(p_list != ID_TYPE_COMPUTE_LIST);
-	ERR_FAIL_COND(!compute_list);
+	ERR_FAIL_NULL(compute_list);
 
 	ComputeList *cl = compute_list;
 
@@ -8186,7 +8186,7 @@ void RenderingDeviceVulkan::compute_list_dispatch(ComputeListID p_list, uint32_t
 
 void RenderingDeviceVulkan::compute_list_dispatch_threads(ComputeListID p_list, uint32_t p_x_threads, uint32_t p_y_threads, uint32_t p_z_threads) {
 	ERR_FAIL_COND(p_list != ID_TYPE_COMPUTE_LIST);
-	ERR_FAIL_COND(!compute_list);
+	ERR_FAIL_NULL(compute_list);
 
 #ifdef DEBUG_ENABLED
 	ERR_FAIL_COND_MSG(p_x_threads == 0, "Dispatch amount of X compute threads (" + itos(p_x_threads) + ") is zero.");
@@ -8213,11 +8213,11 @@ void RenderingDeviceVulkan::compute_list_dispatch_threads(ComputeListID p_list,
 
 void RenderingDeviceVulkan::compute_list_dispatch_indirect(ComputeListID p_list, RID p_buffer, uint32_t p_offset) {
 	ERR_FAIL_COND(p_list != ID_TYPE_COMPUTE_LIST);
-	ERR_FAIL_COND(!compute_list);
+	ERR_FAIL_NULL(compute_list);
 
 	ComputeList *cl = compute_list;
 	Buffer *buffer = storage_buffer_owner.get_or_null(p_buffer);
-	ERR_FAIL_COND(!buffer);
+	ERR_FAIL_NULL(buffer);
 
 	ERR_FAIL_COND_MSG(!(buffer->usage & VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT), "Buffer provided was not created to do indirect dispatch.");
 
@@ -8276,7 +8276,7 @@ void RenderingDeviceVulkan::compute_list_add_barrier(ComputeListID p_list) {
 }
 
 void RenderingDeviceVulkan::_compute_list_add_barrier(BitField<BarrierMask> p_post_barrier, uint32_t p_barrier_flags, uint32_t p_access_flags) {
-	ERR_FAIL_COND(!compute_list);
+	ERR_FAIL_NULL(compute_list);
 
 	VkImageMemoryBarrier *image_barriers = nullptr;
 
@@ -8335,7 +8335,7 @@ void RenderingDeviceVulkan::_compute_list_add_barrier(BitField<BarrierMask> p_po
 }
 
 void RenderingDeviceVulkan::compute_list_end(BitField<BarrierMask> p_post_barrier) {
-	ERR_FAIL_COND(!compute_list);
+	ERR_FAIL_NULL(compute_list);
 
 	uint32_t barrier_flags = 0;
 	uint32_t access_flags = 0;
@@ -8425,7 +8425,7 @@ void RenderingDeviceVulkan::full_barrier() {
 #if 0
 void RenderingDeviceVulkan::draw_list_render_secondary_to_framebuffer(ID p_framebuffer, ID *p_draw_lists, uint32_t p_draw_list_count, InitialAction p_initial_action, FinalAction p_final_action, const Vector<Variant> &p_clear_colors) {
 	VkCommandBuffer frame_cmdbuf = frames[frame].frame_buffer;
-	ERR_FAIL_COND(!frame_cmdbuf);
+	ERR_FAIL_NULL(frame_cmdbuf);
 
 	VkRenderPassBeginInfo render_pass_begin;
 	render_pass_begin.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;

+ 9 - 9
drivers/windows/file_access_windows.cpp

@@ -50,7 +50,7 @@
 #endif
 
 void FileAccessWindows::check_errors() const {
-	ERR_FAIL_COND(!f);
+	ERR_FAIL_NULL(f);
 
 	if (feof(f)) {
 		last_error = ERR_FILE_EOF;
@@ -223,7 +223,7 @@ bool FileAccessWindows::is_open() const {
 }
 
 void FileAccessWindows::seek(uint64_t p_position) {
-	ERR_FAIL_COND(!f);
+	ERR_FAIL_NULL(f);
 
 	last_error = OK;
 	if (_fseeki64(f, p_position, SEEK_SET)) {
@@ -233,7 +233,7 @@ void FileAccessWindows::seek(uint64_t p_position) {
 }
 
 void FileAccessWindows::seek_end(int64_t p_position) {
-	ERR_FAIL_COND(!f);
+	ERR_FAIL_NULL(f);
 
 	if (_fseeki64(f, p_position, SEEK_END)) {
 		check_errors();
@@ -250,7 +250,7 @@ uint64_t FileAccessWindows::get_position() const {
 }
 
 uint64_t FileAccessWindows::get_length() const {
-	ERR_FAIL_COND_V(!f, 0);
+	ERR_FAIL_NULL_V(f, 0);
 
 	uint64_t pos = get_position();
 	_fseeki64(f, 0, SEEK_END);
@@ -266,7 +266,7 @@ bool FileAccessWindows::eof_reached() const {
 }
 
 uint8_t FileAccessWindows::get_8() const {
-	ERR_FAIL_COND_V(!f, 0);
+	ERR_FAIL_NULL_V(f, 0);
 
 	if (flags == READ_WRITE || flags == WRITE_READ) {
 		if (prev_op == WRITE) {
@@ -285,7 +285,7 @@ uint8_t FileAccessWindows::get_8() const {
 
 uint64_t FileAccessWindows::get_buffer(uint8_t *p_dst, uint64_t p_length) const {
 	ERR_FAIL_COND_V(!p_dst && p_length > 0, -1);
-	ERR_FAIL_COND_V(!f, -1);
+	ERR_FAIL_NULL_V(f, -1);
 
 	if (flags == READ_WRITE || flags == WRITE_READ) {
 		if (prev_op == WRITE) {
@@ -303,7 +303,7 @@ Error FileAccessWindows::get_error() const {
 }
 
 void FileAccessWindows::flush() {
-	ERR_FAIL_COND(!f);
+	ERR_FAIL_NULL(f);
 
 	fflush(f);
 	if (prev_op == WRITE) {
@@ -312,7 +312,7 @@ void FileAccessWindows::flush() {
 }
 
 void FileAccessWindows::store_8(uint8_t p_dest) {
-	ERR_FAIL_COND(!f);
+	ERR_FAIL_NULL(f);
 
 	if (flags == READ_WRITE || flags == WRITE_READ) {
 		if (prev_op == READ) {
@@ -326,7 +326,7 @@ void FileAccessWindows::store_8(uint8_t p_dest) {
 }
 
 void FileAccessWindows::store_buffer(const uint8_t *p_src, uint64_t p_length) {
-	ERR_FAIL_COND(!f);
+	ERR_FAIL_NULL(f);
 	ERR_FAIL_COND(!p_src && p_length > 0);
 
 	if (flags == READ_WRITE || flags == WRITE_READ) {

+ 13 - 13
platform/android/dir_access_jandroid.cpp

@@ -67,7 +67,7 @@ String DirAccessJAndroid::get_next() {
 	ERR_FAIL_COND_V(id == 0, "");
 	if (_dir_next) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, "");
+		ERR_FAIL_NULL_V(env, "");
 		jstring str = (jstring)env->CallObjectMethod(dir_access_handler, _dir_next, get_access_type(), id);
 		if (!str) {
 			return "";
@@ -84,7 +84,7 @@ String DirAccessJAndroid::get_next() {
 bool DirAccessJAndroid::current_is_dir() const {
 	if (_dir_is_dir) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, false);
+		ERR_FAIL_NULL_V(env, false);
 		return env->CallBooleanMethod(dir_access_handler, _dir_is_dir, get_access_type(), id);
 	} else {
 		return false;
@@ -94,7 +94,7 @@ bool DirAccessJAndroid::current_is_dir() const {
 bool DirAccessJAndroid::current_is_hidden() const {
 	if (_current_is_hidden) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, false);
+		ERR_FAIL_NULL_V(env, false);
 		return env->CallBooleanMethod(dir_access_handler, _current_is_hidden, get_access_type(), id);
 	}
 	return false;
@@ -112,7 +112,7 @@ void DirAccessJAndroid::list_dir_end() {
 int DirAccessJAndroid::get_drive_count() {
 	if (_get_drive_count) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, 0);
+		ERR_FAIL_NULL_V(env, 0);
 		return env->CallIntMethod(dir_access_handler, _get_drive_count, get_access_type());
 	} else {
 		return 0;
@@ -122,7 +122,7 @@ int DirAccessJAndroid::get_drive_count() {
 String DirAccessJAndroid::get_drive(int p_drive) {
 	if (_get_drive) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, "");
+		ERR_FAIL_NULL_V(env, "");
 		jstring j_drive = (jstring)env->CallObjectMethod(dir_access_handler, _get_drive, get_access_type(), p_drive);
 		if (!j_drive) {
 			return "";
@@ -191,7 +191,7 @@ String DirAccessJAndroid::get_absolute_path(String p_path) {
 bool DirAccessJAndroid::file_exists(String p_file) {
 	if (_file_exists) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, false);
+		ERR_FAIL_NULL_V(env, false);
 
 		String path = get_absolute_path(p_file);
 		jstring j_path = env->NewStringUTF(path.utf8().get_data());
@@ -206,7 +206,7 @@ bool DirAccessJAndroid::file_exists(String p_file) {
 bool DirAccessJAndroid::dir_exists(String p_dir) {
 	if (_dir_exists) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, false);
+		ERR_FAIL_NULL_V(env, false);
 
 		String path = get_absolute_path(p_dir);
 		jstring j_path = env->NewStringUTF(path.utf8().get_data());
@@ -226,7 +226,7 @@ Error DirAccessJAndroid::make_dir_recursive(String p_dir) {
 
 	if (_make_dir) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, ERR_UNCONFIGURED);
+		ERR_FAIL_NULL_V(env, ERR_UNCONFIGURED);
 
 		String path = get_absolute_path(p_dir);
 		jstring j_dir = env->NewStringUTF(path.utf8().get_data());
@@ -249,7 +249,7 @@ Error DirAccessJAndroid::make_dir(String p_dir) {
 Error DirAccessJAndroid::rename(String p_from, String p_to) {
 	if (_rename) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, ERR_UNCONFIGURED);
+		ERR_FAIL_NULL_V(env, ERR_UNCONFIGURED);
 
 		String from_path = get_absolute_path(p_from);
 		jstring j_from = env->NewStringUTF(from_path.utf8().get_data());
@@ -273,7 +273,7 @@ Error DirAccessJAndroid::rename(String p_from, String p_to) {
 Error DirAccessJAndroid::remove(String p_name) {
 	if (_remove) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, ERR_UNCONFIGURED);
+		ERR_FAIL_NULL_V(env, ERR_UNCONFIGURED);
 
 		String path = get_absolute_path(p_name);
 		jstring j_name = env->NewStringUTF(path.utf8().get_data());
@@ -292,7 +292,7 @@ Error DirAccessJAndroid::remove(String p_name) {
 uint64_t DirAccessJAndroid::get_space_left() {
 	if (_get_space_left) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, 0);
+		ERR_FAIL_NULL_V(env, 0);
 		return env->CallLongMethod(dir_access_handler, _get_space_left, get_access_type());
 	} else {
 		return 0;
@@ -331,7 +331,7 @@ DirAccessJAndroid::~DirAccessJAndroid() {
 int DirAccessJAndroid::dir_open(String p_path) {
 	if (_dir_open) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, 0);
+		ERR_FAIL_NULL_V(env, 0);
 
 		String path = get_absolute_path(p_path);
 		jstring js = env->NewStringUTF(path.utf8().get_data());
@@ -346,7 +346,7 @@ int DirAccessJAndroid::dir_open(String p_path) {
 void DirAccessJAndroid::dir_close(int p_id) {
 	if (_dir_close) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND(env == nullptr);
+		ERR_FAIL_NULL(env);
 		env->CallVoidMethod(dir_access_handler, _dir_close, get_access_type(), p_id);
 	}
 }

+ 13 - 13
platform/android/file_access_filesystem_jandroid.cpp

@@ -69,7 +69,7 @@ Error FileAccessFilesystemJAndroid::open_internal(const String &p_path, int p_mo
 
 	if (_file_open) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, ERR_UNCONFIGURED);
+		ERR_FAIL_NULL_V(env, ERR_UNCONFIGURED);
 
 		String path = fix_path(p_path).simplify_path();
 		jstring js = env->NewStringUTF(path.utf8().get_data());
@@ -103,7 +103,7 @@ void FileAccessFilesystemJAndroid::_close() {
 
 	if (_file_close) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND(env == nullptr);
+		ERR_FAIL_NULL(env);
 		env->CallVoidMethod(file_access_handler, _file_close, id);
 	}
 	id = 0;
@@ -116,7 +116,7 @@ bool FileAccessFilesystemJAndroid::is_open() const {
 void FileAccessFilesystemJAndroid::seek(uint64_t p_position) {
 	if (_file_seek) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND(env == nullptr);
+		ERR_FAIL_NULL(env);
 		ERR_FAIL_COND_MSG(!is_open(), "File must be opened before use.");
 		env->CallVoidMethod(file_access_handler, _file_seek, id, p_position);
 	}
@@ -125,7 +125,7 @@ void FileAccessFilesystemJAndroid::seek(uint64_t p_position) {
 void FileAccessFilesystemJAndroid::seek_end(int64_t p_position) {
 	if (_file_seek_end) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND(env == nullptr);
+		ERR_FAIL_NULL(env);
 		ERR_FAIL_COND_MSG(!is_open(), "File must be opened before use.");
 		env->CallVoidMethod(file_access_handler, _file_seek_end, id, p_position);
 	}
@@ -134,7 +134,7 @@ void FileAccessFilesystemJAndroid::seek_end(int64_t p_position) {
 uint64_t FileAccessFilesystemJAndroid::get_position() const {
 	if (_file_tell) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, 0);
+		ERR_FAIL_NULL_V(env, 0);
 		ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use.");
 		return env->CallLongMethod(file_access_handler, _file_tell, id);
 	} else {
@@ -145,7 +145,7 @@ uint64_t FileAccessFilesystemJAndroid::get_position() const {
 uint64_t FileAccessFilesystemJAndroid::get_length() const {
 	if (_file_get_size) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, 0);
+		ERR_FAIL_NULL_V(env, 0);
 		ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use.");
 		return env->CallLongMethod(file_access_handler, _file_get_size, id);
 	} else {
@@ -156,7 +156,7 @@ uint64_t FileAccessFilesystemJAndroid::get_length() const {
 bool FileAccessFilesystemJAndroid::eof_reached() const {
 	if (_file_eof) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, false);
+		ERR_FAIL_NULL_V(env, false);
 		ERR_FAIL_COND_V_MSG(!is_open(), false, "File must be opened before use.");
 		return env->CallBooleanMethod(file_access_handler, _file_eof, id);
 	} else {
@@ -169,7 +169,7 @@ void FileAccessFilesystemJAndroid::_set_eof(bool eof) {
 		ERR_FAIL_COND_MSG(!is_open(), "File must be opened before use.");
 
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND(env == nullptr);
+		ERR_FAIL_NULL(env);
 		env->CallVoidMethod(file_access_handler, _file_set_eof, id, eof);
 	}
 }
@@ -235,7 +235,7 @@ uint64_t FileAccessFilesystemJAndroid::get_buffer(uint8_t *p_dst, uint64_t p_len
 		}
 
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, 0);
+		ERR_FAIL_NULL_V(env, 0);
 
 		jobject j_buffer = env->NewDirectByteBuffer(p_dst, p_length);
 		int length = env->CallIntMethod(file_access_handler, _file_read, id, j_buffer);
@@ -258,7 +258,7 @@ void FileAccessFilesystemJAndroid::store_buffer(const uint8_t *p_src, uint64_t p
 		}
 
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND(env == nullptr);
+		ERR_FAIL_NULL(env);
 
 		jobject j_buffer = env->NewDirectByteBuffer((void *)p_src, p_length);
 		env->CallVoidMethod(file_access_handler, _file_write, id, j_buffer);
@@ -276,7 +276,7 @@ Error FileAccessFilesystemJAndroid::get_error() const {
 void FileAccessFilesystemJAndroid::flush() {
 	if (_file_flush) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND(env == nullptr);
+		ERR_FAIL_NULL(env);
 		ERR_FAIL_COND_MSG(!is_open(), "File must be opened before use.");
 		env->CallVoidMethod(file_access_handler, _file_flush, id);
 	}
@@ -285,7 +285,7 @@ void FileAccessFilesystemJAndroid::flush() {
 bool FileAccessFilesystemJAndroid::file_exists(const String &p_path) {
 	if (_file_exists) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, false);
+		ERR_FAIL_NULL_V(env, false);
 
 		String path = fix_path(p_path).simplify_path();
 		jstring js = env->NewStringUTF(path.utf8().get_data());
@@ -300,7 +300,7 @@ bool FileAccessFilesystemJAndroid::file_exists(const String &p_path) {
 uint64_t FileAccessFilesystemJAndroid::_get_modified_time(const String &p_file) {
 	if (_file_last_modified) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, false);
+		ERR_FAIL_NULL_V(env, false);
 
 		String path = fix_path(p_file).simplify_path();
 		jstring js = env->NewStringUTF(path.utf8().get_data());

+ 8 - 8
platform/android/tts_android.cpp

@@ -54,7 +54,7 @@ void TTS_Android::setup(jobject p_tts) {
 	bool tts_enabled = GLOBAL_GET("audio/general/text_to_speech");
 	if (tts_enabled) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND(env == nullptr);
+		ERR_FAIL_NULL(env);
 
 		tts = env->NewGlobalRef(p_tts);
 
@@ -103,7 +103,7 @@ bool TTS_Android::is_speaking() {
 	if (_is_speaking) {
 		JNIEnv *env = get_jni_env();
 
-		ERR_FAIL_COND_V(env == nullptr, false);
+		ERR_FAIL_NULL_V(env, false);
 		return env->CallBooleanMethod(tts, _is_speaking);
 	} else {
 		return false;
@@ -115,7 +115,7 @@ bool TTS_Android::is_paused() {
 	if (_is_paused) {
 		JNIEnv *env = get_jni_env();
 
-		ERR_FAIL_COND_V(env == nullptr, false);
+		ERR_FAIL_NULL_V(env, false);
 		return env->CallBooleanMethod(tts, _is_paused);
 	} else {
 		return false;
@@ -127,7 +127,7 @@ Array TTS_Android::get_voices() {
 	Array list;
 	if (_get_voices) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND_V(env == nullptr, list);
+		ERR_FAIL_NULL_V(env, list);
 
 		jobject voices_object = env->CallObjectMethod(tts, _get_voices);
 		jobjectArray *arr = reinterpret_cast<jobjectArray *>(&voices_object);
@@ -165,7 +165,7 @@ void TTS_Android::speak(const String &p_text, const String &p_voice, int p_volum
 
 	if (_speak) {
 		JNIEnv *env = get_jni_env();
-		ERR_FAIL_COND(env == nullptr);
+		ERR_FAIL_NULL(env);
 
 		jstring jStrT = env->NewStringUTF(p_text.utf8().get_data());
 		jstring jStrV = env->NewStringUTF(p_voice.utf8().get_data());
@@ -178,7 +178,7 @@ void TTS_Android::pause() {
 	if (_pause_speaking) {
 		JNIEnv *env = get_jni_env();
 
-		ERR_FAIL_COND(env == nullptr);
+		ERR_FAIL_NULL(env);
 		env->CallVoidMethod(tts, _pause_speaking);
 	}
 }
@@ -188,7 +188,7 @@ void TTS_Android::resume() {
 	if (_resume_speaking) {
 		JNIEnv *env = get_jni_env();
 
-		ERR_FAIL_COND(env == nullptr);
+		ERR_FAIL_NULL(env);
 		env->CallVoidMethod(tts, _resume_speaking);
 	}
 }
@@ -203,7 +203,7 @@ void TTS_Android::stop() {
 	if (_stop_speaking) {
 		JNIEnv *env = get_jni_env();
 
-		ERR_FAIL_COND(env == nullptr);
+		ERR_FAIL_NULL(env);
 		env->CallVoidMethod(tts, _stop_speaking);
 	}
 }

+ 1 - 1
platform/ios/os_ios.mm

@@ -257,7 +257,7 @@ Error OS_IOS::open_dynamic_library(const String p_path, void *&p_library_handle,
 	}
 
 	p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW);
-	ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, vformat("Can't open dynamic library: %s. Error: %s.", p_path, dlerror()));
+	ERR_FAIL_NULL_V_MSG(p_library_handle, ERR_CANT_OPEN, vformat("Can't open dynamic library: %s. Error: %s.", p_path, dlerror()));
 
 	if (r_resolved_path != nullptr) {
 		*r_resolved_path = path;

+ 1 - 1
platform/linuxbsd/godot_linuxbsd.cpp

@@ -56,7 +56,7 @@ int main(int argc, char *argv[]) {
 	TEST_MAIN_OVERRIDE
 
 	char *cwd = (char *)malloc(PATH_MAX);
-	ERR_FAIL_COND_V(!cwd, ERR_OUT_OF_MEMORY);
+	ERR_FAIL_NULL_V(cwd, ERR_OUT_OF_MEMORY);
 	char *ret = getcwd(cwd, PATH_MAX);
 
 	Error err = Main::setup(argv[0], argc - 1, &argv[1]);

+ 5 - 5
platform/linuxbsd/tts_linux.cpp

@@ -186,7 +186,7 @@ bool TTS_Linux::is_paused() const {
 Array TTS_Linux::get_voices() const {
 	_THREAD_SAFE_METHOD_
 
-	ERR_FAIL_COND_V(!synth, Array());
+	ERR_FAIL_NULL_V(synth, Array());
 	const_cast<TTS_Linux *>(this)->_load_voices();
 
 	Array list;
@@ -204,7 +204,7 @@ Array TTS_Linux::get_voices() const {
 void TTS_Linux::speak(const String &p_text, const String &p_voice, int p_volume, float p_pitch, float p_rate, int p_utterance_id, bool p_interrupt) {
 	_THREAD_SAFE_METHOD_
 
-	ERR_FAIL_COND(!synth);
+	ERR_FAIL_NULL(synth);
 	if (p_interrupt) {
 		stop();
 	}
@@ -233,7 +233,7 @@ void TTS_Linux::speak(const String &p_text, const String &p_voice, int p_volume,
 void TTS_Linux::pause() {
 	_THREAD_SAFE_METHOD_
 
-	ERR_FAIL_COND(!synth);
+	ERR_FAIL_NULL(synth);
 	if (spd_pause(synth) == 0) {
 		paused = true;
 	}
@@ -242,7 +242,7 @@ void TTS_Linux::pause() {
 void TTS_Linux::resume() {
 	_THREAD_SAFE_METHOD_
 
-	ERR_FAIL_COND(!synth);
+	ERR_FAIL_NULL(synth);
 	spd_resume(synth);
 	paused = false;
 }
@@ -250,7 +250,7 @@ void TTS_Linux::resume() {
 void TTS_Linux::stop() {
 	_THREAD_SAFE_METHOD_
 
-	ERR_FAIL_COND(!synth);
+	ERR_FAIL_NULL(synth);
 	for (DisplayServer::TTSUtterance &message : queue) {
 		DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_CANCELED, message.id);
 	}

+ 8 - 8
platform/linuxbsd/x11/display_server_x11.cpp

@@ -307,37 +307,37 @@ void DisplayServerX11::_flush_mouse_motion() {
 #ifdef SPEECHD_ENABLED
 
 bool DisplayServerX11::tts_is_speaking() const {
-	ERR_FAIL_COND_V_MSG(!tts, false, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
+	ERR_FAIL_NULL_V_MSG(tts, false, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
 	return tts->is_speaking();
 }
 
 bool DisplayServerX11::tts_is_paused() const {
-	ERR_FAIL_COND_V_MSG(!tts, false, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
+	ERR_FAIL_NULL_V_MSG(tts, false, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
 	return tts->is_paused();
 }
 
 TypedArray<Dictionary> DisplayServerX11::tts_get_voices() const {
-	ERR_FAIL_COND_V_MSG(!tts, TypedArray<Dictionary>(), "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
+	ERR_FAIL_NULL_V_MSG(tts, TypedArray<Dictionary>(), "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
 	return tts->get_voices();
 }
 
 void DisplayServerX11::tts_speak(const String &p_text, const String &p_voice, int p_volume, float p_pitch, float p_rate, int p_utterance_id, bool p_interrupt) {
-	ERR_FAIL_COND_MSG(!tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
+	ERR_FAIL_NULL_MSG(tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
 	tts->speak(p_text, p_voice, p_volume, p_pitch, p_rate, p_utterance_id, p_interrupt);
 }
 
 void DisplayServerX11::tts_pause() {
-	ERR_FAIL_COND_MSG(!tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
+	ERR_FAIL_NULL_MSG(tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
 	tts->pause();
 }
 
 void DisplayServerX11::tts_resume() {
-	ERR_FAIL_COND_MSG(!tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
+	ERR_FAIL_NULL_MSG(tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
 	tts->resume();
 }
 
 void DisplayServerX11::tts_stop() {
-	ERR_FAIL_COND_MSG(!tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
+	ERR_FAIL_NULL_MSG(tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
 	tts->stop();
 }
 
@@ -5100,7 +5100,7 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, V
 		XVisualInfo vInfoTemplate = {};
 		vInfoTemplate.screen = DefaultScreen(x11_display);
 		XVisualInfo *vi_list = XGetVisualInfo(x11_display, visualMask, &vInfoTemplate, &numberOfVisuals);
-		ERR_FAIL_COND_V(!vi_list, INVALID_WINDOW_ID);
+		ERR_FAIL_NULL_V(vi_list, INVALID_WINDOW_ID);
 
 		visualInfo = vi_list[0];
 		if (OS::get_singleton()->is_layered_allowed()) {

+ 4 - 4
platform/linuxbsd/x11/gl_manager_x11.cpp

@@ -103,7 +103,7 @@ Error GLManager_X11::_create_context(GLDisplay &gl_display) {
 
 	GLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = (GLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress((const GLubyte *)"glXCreateContextAttribsARB");
 
-	ERR_FAIL_COND_V(!glXCreateContextAttribsARB, ERR_UNCONFIGURED);
+	ERR_FAIL_NULL_V(glXCreateContextAttribsARB, ERR_UNCONFIGURED);
 
 	static int visual_attribs[] = {
 		GLX_RENDER_TYPE, GLX_RGBA_BIT,
@@ -134,7 +134,7 @@ Error GLManager_X11::_create_context(GLDisplay &gl_display) {
 
 	if (OS::get_singleton()->is_layered_allowed()) {
 		GLXFBConfig *fbc = glXChooseFBConfig(x11_display, DefaultScreen(x11_display), visual_attribs_layered, &fbcount);
-		ERR_FAIL_COND_V(!fbc, ERR_UNCONFIGURED);
+		ERR_FAIL_NULL_V(fbc, ERR_UNCONFIGURED);
 
 		for (int i = 0; i < fbcount; i++) {
 			vi = (XVisualInfo *)glXGetVisualFromFBConfig(x11_display, fbc[i]);
@@ -156,10 +156,10 @@ Error GLManager_X11::_create_context(GLDisplay &gl_display) {
 		}
 		XFree(fbc);
 
-		ERR_FAIL_COND_V(!fbconfig, ERR_UNCONFIGURED);
+		ERR_FAIL_NULL_V(fbconfig, ERR_UNCONFIGURED);
 	} else {
 		GLXFBConfig *fbc = glXChooseFBConfig(x11_display, DefaultScreen(x11_display), visual_attribs, &fbcount);
-		ERR_FAIL_COND_V(!fbc, ERR_UNCONFIGURED);
+		ERR_FAIL_NULL_V(fbc, ERR_UNCONFIGURED);
 
 		vi = glXGetVisualFromFBConfig(x11_display, fbc[0]);
 

+ 10 - 10
platform/macos/display_server_macos.mm

@@ -1451,7 +1451,7 @@ void DisplayServerMacOS::global_menu_set_item_checkable(const String &p_menu_roo
 		NSMenuItem *menu_item = [menu itemAtIndex:p_idx];
 		if (menu_item) {
 			GodotMenuItem *obj = [menu_item representedObject];
-			ERR_FAIL_COND(!obj);
+			ERR_FAIL_NULL(obj);
 			obj->checkable_type = (p_checkable) ? CHECKABLE_TYPE_CHECK_BOX : CHECKABLE_TYPE_NONE;
 		}
 	}
@@ -1470,7 +1470,7 @@ void DisplayServerMacOS::global_menu_set_item_radio_checkable(const String &p_me
 		NSMenuItem *menu_item = [menu itemAtIndex:p_idx];
 		if (menu_item) {
 			GodotMenuItem *obj = [menu_item representedObject];
-			ERR_FAIL_COND(!obj);
+			ERR_FAIL_NULL(obj);
 			obj->checkable_type = (p_checkable) ? CHECKABLE_TYPE_RADIO_BUTTON : CHECKABLE_TYPE_NONE;
 		}
 	}
@@ -1489,7 +1489,7 @@ void DisplayServerMacOS::global_menu_set_item_callback(const String &p_menu_root
 		NSMenuItem *menu_item = [menu itemAtIndex:p_idx];
 		if (menu_item) {
 			GodotMenuItem *obj = [menu_item representedObject];
-			ERR_FAIL_COND(!obj);
+			ERR_FAIL_NULL(obj);
 			obj->callback = p_callback;
 		}
 	}
@@ -1508,7 +1508,7 @@ void DisplayServerMacOS::global_menu_set_item_key_callback(const String &p_menu_
 		NSMenuItem *menu_item = [menu itemAtIndex:p_idx];
 		if (menu_item) {
 			GodotMenuItem *obj = [menu_item representedObject];
-			ERR_FAIL_COND(!obj);
+			ERR_FAIL_NULL(obj);
 			obj->key_callback = p_key_callback;
 		}
 	}
@@ -1527,7 +1527,7 @@ void DisplayServerMacOS::global_menu_set_item_tag(const String &p_menu_root, int
 		NSMenuItem *menu_item = [menu itemAtIndex:p_idx];
 		if (menu_item) {
 			GodotMenuItem *obj = [menu_item representedObject];
-			ERR_FAIL_COND(!obj);
+			ERR_FAIL_NULL(obj);
 			obj->meta = p_tag;
 		}
 	}
@@ -1642,7 +1642,7 @@ void DisplayServerMacOS::global_menu_set_item_state(const String &p_menu_root, i
 		NSMenuItem *menu_item = [menu itemAtIndex:p_idx];
 		if (menu_item) {
 			GodotMenuItem *obj = [menu_item representedObject];
-			ERR_FAIL_COND(!obj);
+			ERR_FAIL_NULL(obj);
 			obj->state = p_state;
 		}
 	}
@@ -1661,7 +1661,7 @@ void DisplayServerMacOS::global_menu_set_item_max_states(const String &p_menu_ro
 		NSMenuItem *menu_item = [menu itemAtIndex:p_idx];
 		if (menu_item) {
 			GodotMenuItem *obj = [menu_item representedObject];
-			ERR_FAIL_COND(!obj);
+			ERR_FAIL_NULL(obj);
 			obj->max_states = p_max_states;
 		}
 	}
@@ -1680,7 +1680,7 @@ void DisplayServerMacOS::global_menu_set_item_icon(const String &p_menu_root, in
 		NSMenuItem *menu_item = [menu itemAtIndex:p_idx];
 		if (menu_item) {
 			GodotMenuItem *obj = [menu_item representedObject];
-			ERR_FAIL_COND(!obj);
+			ERR_FAIL_NULL(obj);
 			if (p_icon.is_valid()) {
 				obj->img = p_icon->get_image();
 				obj->img = obj->img->duplicate();
@@ -3826,10 +3826,10 @@ void DisplayServerMacOS::set_native_icon(const String &p_filename) {
 
 	@try {
 		NSData *icon_data = [[NSData alloc] initWithBytes:&data.write[0] length:len];
-		ERR_FAIL_COND_MSG(!icon_data, "Error reading icon data.");
+		ERR_FAIL_NULL_MSG(icon_data, "Error reading icon data.");
 
 		NSImage *icon = [[NSImage alloc] initWithData:icon_data];
-		ERR_FAIL_COND_MSG(!icon, "Error loading icon.");
+		ERR_FAIL_NULL_MSG(icon, "Error loading icon.");
 
 		[NSApp setApplicationIconImage:icon];
 	} @catch (NSException *exception) {

+ 1 - 1
platform/macos/os_macos.mm

@@ -231,7 +231,7 @@ Error OS_MacOS::open_dynamic_library(const String p_path, void *&p_library_handl
 	}
 
 	p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW);
-	ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, vformat("Can't open dynamic library: %s. Error: %s.", p_path, dlerror()));
+	ERR_FAIL_NULL_V_MSG(p_library_handle, ERR_CANT_OPEN, vformat("Can't open dynamic library: %s. Error: %s.", p_path, dlerror()));
 
 	if (r_resolved_path != nullptr) {
 		*r_resolved_path = path;

+ 1 - 1
platform/web/os_web.cpp

@@ -232,7 +232,7 @@ bool OS_Web::is_userfs_persistent() const {
 Error OS_Web::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path, String *r_resolved_path) {
 	String path = p_path.get_file();
 	p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW);
-	ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, vformat("Can't open dynamic library: %s. Error: %s.", p_path, dlerror()));
+	ERR_FAIL_NULL_V_MSG(p_library_handle, ERR_CANT_OPEN, vformat("Can't open dynamic library: %s. Error: %s.", p_path, dlerror()));
 
 	if (r_resolved_path != nullptr) {
 		*r_resolved_path = path;

+ 10 - 10
platform/windows/display_server_windows.cpp

@@ -184,37 +184,37 @@ void DisplayServerWindows::_register_raw_input_devices(WindowID p_target_window)
 }
 
 bool DisplayServerWindows::tts_is_speaking() const {
-	ERR_FAIL_COND_V_MSG(!tts, false, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
+	ERR_FAIL_NULL_V_MSG(tts, false, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
 	return tts->is_speaking();
 }
 
 bool DisplayServerWindows::tts_is_paused() const {
-	ERR_FAIL_COND_V_MSG(!tts, false, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
+	ERR_FAIL_NULL_V_MSG(tts, false, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
 	return tts->is_paused();
 }
 
 TypedArray<Dictionary> DisplayServerWindows::tts_get_voices() const {
-	ERR_FAIL_COND_V_MSG(!tts, TypedArray<Dictionary>(), "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
+	ERR_FAIL_NULL_V_MSG(tts, TypedArray<Dictionary>(), "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
 	return tts->get_voices();
 }
 
 void DisplayServerWindows::tts_speak(const String &p_text, const String &p_voice, int p_volume, float p_pitch, float p_rate, int p_utterance_id, bool p_interrupt) {
-	ERR_FAIL_COND_MSG(!tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
+	ERR_FAIL_NULL_MSG(tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
 	tts->speak(p_text, p_voice, p_volume, p_pitch, p_rate, p_utterance_id, p_interrupt);
 }
 
 void DisplayServerWindows::tts_pause() {
-	ERR_FAIL_COND_MSG(!tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
+	ERR_FAIL_NULL_MSG(tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
 	tts->pause();
 }
 
 void DisplayServerWindows::tts_resume() {
-	ERR_FAIL_COND_MSG(!tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
+	ERR_FAIL_NULL_MSG(tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
 	tts->resume();
 }
 
 void DisplayServerWindows::tts_stop() {
-	ERR_FAIL_COND_MSG(!tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
+	ERR_FAIL_NULL_MSG(tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
 	tts->stop();
 }
 
@@ -413,7 +413,7 @@ void DisplayServerWindows::clipboard_set(const String &p_text) {
 
 	Char16String utf16 = text.utf16();
 	HGLOBAL mem = GlobalAlloc(GMEM_MOVEABLE, (utf16.length() + 1) * sizeof(WCHAR));
-	ERR_FAIL_COND_MSG(mem == nullptr, "Unable to allocate memory for clipboard contents.");
+	ERR_FAIL_NULL_MSG(mem, "Unable to allocate memory for clipboard contents.");
 
 	LPWSTR lptstrCopy = (LPWSTR)GlobalLock(mem);
 	memcpy(lptstrCopy, utf16.get_data(), (utf16.length() + 1) * sizeof(WCHAR));
@@ -424,7 +424,7 @@ void DisplayServerWindows::clipboard_set(const String &p_text) {
 	// Set the CF_TEXT version (not needed?).
 	CharString utf8 = text.utf8();
 	mem = GlobalAlloc(GMEM_MOVEABLE, utf8.length() + 1);
-	ERR_FAIL_COND_MSG(mem == nullptr, "Unable to allocate memory for clipboard contents.");
+	ERR_FAIL_NULL_MSG(mem, "Unable to allocate memory for clipboard contents.");
 
 	LPTSTR ptr = (LPTSTR)GlobalLock(mem);
 	memcpy(ptr, utf8.get_data(), utf8.length());
@@ -2465,7 +2465,7 @@ void DisplayServerWindows::set_icon(const Ref<Image> &p_icon) {
 		}
 
 		HICON hicon = CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000);
-		ERR_FAIL_COND(!hicon);
+		ERR_FAIL_NULL(hicon);
 
 		icon = img;
 

+ 2 - 2
platform/windows/os_windows.cpp

@@ -395,7 +395,7 @@ Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_han
 		}
 	}
 #else
-	ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, vformat("Can't open dynamic library: %s. Error: %s.", p_path, format_error_message(GetLastError())));
+	ERR_FAIL_NULL_V_MSG(p_library_handle, ERR_CANT_OPEN, vformat("Can't open dynamic library: %s. Error: %s.", p_path, format_error_message(GetLastError())));
 #endif
 
 	if (cookie) {
@@ -1678,7 +1678,7 @@ Error OS_Windows::move_to_trash(const String &p_path) {
 
 String OS_Windows::get_system_ca_certificates() {
 	HCERTSTORE cert_store = CertOpenSystemStoreA(0, "ROOT");
-	ERR_FAIL_COND_V_MSG(!cert_store, "", "Failed to read the root certificate store.");
+	ERR_FAIL_NULL_V_MSG(cert_store, "", "Failed to read the root certificate store.");
 
 	FILETIME curr_time;
 	GetSystemTimeAsFileTime(&curr_time);

+ 6 - 6
platform/windows/tts_windows.cpp

@@ -114,7 +114,7 @@ void TTS_Windows::_update_tts() {
 }
 
 bool TTS_Windows::is_speaking() const {
-	ERR_FAIL_COND_V(!synth, false);
+	ERR_FAIL_NULL_V(synth, false);
 
 	SPVOICESTATUS status;
 	synth->GetStatus(&status, nullptr);
@@ -122,7 +122,7 @@ bool TTS_Windows::is_speaking() const {
 }
 
 bool TTS_Windows::is_paused() const {
-	ERR_FAIL_COND_V(!synth, false);
+	ERR_FAIL_NULL_V(synth, false);
 	return paused;
 }
 
@@ -185,7 +185,7 @@ Array TTS_Windows::get_voices() const {
 }
 
 void TTS_Windows::speak(const String &p_text, const String &p_voice, int p_volume, float p_pitch, float p_rate, int p_utterance_id, bool p_interrupt) {
-	ERR_FAIL_COND(!synth);
+	ERR_FAIL_NULL(synth);
 	if (p_interrupt) {
 		stop();
 	}
@@ -212,7 +212,7 @@ void TTS_Windows::speak(const String &p_text, const String &p_voice, int p_volum
 }
 
 void TTS_Windows::pause() {
-	ERR_FAIL_COND(!synth);
+	ERR_FAIL_NULL(synth);
 	if (!paused) {
 		if (synth->Pause() == S_OK) {
 			paused = true;
@@ -221,13 +221,13 @@ void TTS_Windows::pause() {
 }
 
 void TTS_Windows::resume() {
-	ERR_FAIL_COND(!synth);
+	ERR_FAIL_NULL(synth);
 	synth->Resume();
 	paused = false;
 }
 
 void TTS_Windows::stop() {
-	ERR_FAIL_COND(!synth);
+	ERR_FAIL_NULL(synth);
 
 	SPVOICESTATUS status;
 	synth->GetStatus(&status, nullptr);