diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-10-09 15:37:14 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-10-09 15:37:14 +0200 |
commit | a1d7c62df7bfe52915336f83e4ca71d510bf3baf (patch) | |
tree | 2a409a0ba9235f8334e23222cc66bd5d0f08e32c | |
parent | 336260b7b3eacc979fe0a891d1668e360d705781 (diff) | |
parent | f18aa00e8505439c1afc3dc0eb309429a88cf4de (diff) | |
download | redot-engine-a1d7c62df7bfe52915336f83e4ca71d510bf3baf.tar.gz |
Merge pull request #83003 from AThousandShips/null_check_extra
Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable
45 files changed, 85 insertions, 85 deletions
diff --git a/core/extension/gdextension.cpp b/core/extension/gdextension.cpp index a4d4b9161e..2a287a1816 100644 --- a/core/extension/gdextension.cpp +++ b/core/extension/gdextension.cpp @@ -776,7 +776,7 @@ void GDExtension::initialize_library(InitializationLevel p_level) { level_initialized = int32_t(p_level); - ERR_FAIL_COND(initialization.initialize == nullptr); + ERR_FAIL_NULL(initialization.initialize); initialization.initialize(initialization.userdata, GDExtensionInitializationLevel(p_level)); } diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp index d085c29728..dd45332412 100644 --- a/core/io/file_access_zip.cpp +++ b/core/io/file_access_zip.cpp @@ -110,7 +110,7 @@ static void godot_free(voidpf opaque, voidpf address) { } // extern "C" void ZipArchive::close_handle(unzFile p_file) const { - ERR_FAIL_COND_MSG(!p_file, "Cannot close a file if none is open."); + ERR_FAIL_NULL_MSG(p_file, "Cannot close a file if none is open."); unzCloseCurrentFile(p_file); unzClose(p_file); } @@ -136,7 +136,7 @@ unzFile ZipArchive::get_file_handle(String p_file) const { io.free_mem = godot_free; unzFile pkg = unzOpen2(packages[file.package].filename.utf8().get_data(), &io); - ERR_FAIL_COND_V_MSG(!pkg, nullptr, "Cannot open file '" + packages[file.package].filename + "'."); + ERR_FAIL_NULL_V_MSG(pkg, nullptr, "Cannot open file '" + packages[file.package].filename + "'."); int unz_err = unzGoToFilePos(pkg, &file.file_pos); if (unz_err != UNZ_OK || unzOpenCurrentFile(pkg) != UNZ_OK) { unzClose(pkg); @@ -168,7 +168,7 @@ bool ZipArchive::try_open_pack(const String &p_path, bool p_replace_files, uint6 io.zerror_file = godot_testerror; unzFile zfile = unzOpen2(p_path.utf8().get_data(), &io); - ERR_FAIL_COND_V(!zfile, false); + ERR_FAIL_NULL_V(zfile, false); unz_global_info64 gi; int err = unzGetGlobalInfo64(zfile, &gi); @@ -241,7 +241,7 @@ Error FileAccessZip::open_internal(const String &p_path, int p_mode_flags) { ZipArchive *arch = ZipArchive::get_singleton(); ERR_FAIL_NULL_V(arch, FAILED); zfile = arch->get_file_handle(p_path); - ERR_FAIL_COND_V(!zfile, FAILED); + ERR_FAIL_NULL_V(zfile, FAILED); int err = unzGetCurrentFileInfo64(zfile, &file_info, nullptr, 0, nullptr, 0, nullptr, 0); ERR_FAIL_COND_V(err != UNZ_OK, FAILED); @@ -265,28 +265,28 @@ bool FileAccessZip::is_open() const { } void FileAccessZip::seek(uint64_t p_position) { - ERR_FAIL_COND(!zfile); + ERR_FAIL_NULL(zfile); unzSeekCurrentFile(zfile, p_position); } void FileAccessZip::seek_end(int64_t p_position) { - ERR_FAIL_COND(!zfile); + ERR_FAIL_NULL(zfile); unzSeekCurrentFile(zfile, get_length() + p_position); } uint64_t FileAccessZip::get_position() const { - ERR_FAIL_COND_V(!zfile, 0); + ERR_FAIL_NULL_V(zfile, 0); return unztell(zfile); } uint64_t FileAccessZip::get_length() const { - ERR_FAIL_COND_V(!zfile, 0); + ERR_FAIL_NULL_V(zfile, 0); return file_info.uncompressed_size; } bool FileAccessZip::eof_reached() const { - ERR_FAIL_COND_V(!zfile, true); + ERR_FAIL_NULL_V(zfile, true); return at_eof; } @@ -299,7 +299,7 @@ uint8_t FileAccessZip::get_8() const { uint64_t FileAccessZip::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(!zfile, -1); + ERR_FAIL_NULL_V(zfile, -1); at_eof = unzeof(zfile); if (at_eof) { diff --git a/core/object/callable_method_pointer.h b/core/object/callable_method_pointer.h index 2dbb7e468e..db78b982e4 100644 --- a/core/object/callable_method_pointer.h +++ b/core/object/callable_method_pointer.h @@ -99,7 +99,7 @@ public: virtual void call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const { #ifdef DEBUG_ENABLED - ERR_FAIL_COND_MSG(ObjectDB::get_instance(ObjectID(data.object_id)) == nullptr, "Invalid Object id '" + uitos(data.object_id) + "', can't call method."); + ERR_FAIL_NULL_MSG(ObjectDB::get_instance(ObjectID(data.object_id)), "Invalid Object id '" + uitos(data.object_id) + "', can't call method."); #endif call_with_variant_args(data.instance, data.method, p_arguments, p_argcount, r_call_error); } @@ -154,7 +154,7 @@ public: virtual void call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const { #ifdef DEBUG_ENABLED - ERR_FAIL_COND_MSG(ObjectDB::get_instance(ObjectID(data.object_id)) == nullptr, "Invalid Object id '" + uitos(data.object_id) + "', can't call method."); + ERR_FAIL_NULL_MSG(ObjectDB::get_instance(ObjectID(data.object_id)), "Invalid Object id '" + uitos(data.object_id) + "', can't call method."); #endif call_with_variant_args_ret(data.instance, data.method, p_arguments, p_argcount, r_return_value, r_call_error); } @@ -209,7 +209,7 @@ public: virtual void call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const override { #ifdef DEBUG_ENABLED - ERR_FAIL_COND_MSG(ObjectDB::get_instance(ObjectID(data.object_id)) == nullptr, "Invalid Object id '" + uitos(data.object_id) + "', can't call method."); + ERR_FAIL_NULL_MSG(ObjectDB::get_instance(ObjectID(data.object_id)), "Invalid Object id '" + uitos(data.object_id) + "', can't call method."); #endif call_with_variant_args_retc(data.instance, data.method, p_arguments, p_argcount, r_return_value, r_call_error); } diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index 63ea3274ce..09fb34e7c1 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -2117,7 +2117,7 @@ Variant::operator ::RID() const { } else if (type == OBJECT && _get_obj().obj) { #ifdef DEBUG_ENABLED if (EngineDebugger::is_active()) { - ERR_FAIL_COND_V_MSG(ObjectDB::get_instance(_get_obj().id) == nullptr, ::RID(), "Invalid pointer (object was freed)."); + ERR_FAIL_NULL_V_MSG(ObjectDB::get_instance(_get_obj().id), ::RID(), "Invalid pointer (object was freed)."); } #endif Callable::CallError ce; diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index a4e2bea735..2db17e96f7 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1236,7 +1236,7 @@ void RasterizerCanvasGLES3::_record_item_commands(const Item *p_item, RID p_rend } void RasterizerCanvasGLES3::_render_batch(Light *p_lights, uint32_t p_index) { - ERR_FAIL_COND(!state.canvas_instance_batches[state.current_batch_index].command); + ERR_FAIL_NULL(state.canvas_instance_batches[state.current_batch_index].command); // Used by Polygon and Mesh. static const GLenum prim[5] = { GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_TRIANGLES, GL_TRIANGLE_STRIP }; @@ -2157,7 +2157,7 @@ void RasterizerCanvasGLES3::_bind_canvas_texture(RID p_texture, RS::CanvasItemTe GLES3::Texture *t = texture_storage->get_texture(p_texture); if (t) { - ERR_FAIL_COND(!t->canvas_texture); + ERR_FAIL_NULL(t->canvas_texture); ct = t->canvas_texture; if (t->render_target) { t->render_target->used_in_frame = true; diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp index 016f554368..a2728f854b 100644 --- a/drivers/gles3/storage/material_storage.cpp +++ b/drivers/gles3/storage/material_storage.cpp @@ -2396,7 +2396,7 @@ void MaterialStorage::material_set_shader(RID p_material, RID p_shader) { return; } - ERR_FAIL_COND(shader->data == nullptr); + ERR_FAIL_NULL(shader->data); material->data = material_data_request_func[shader->mode](shader->data); material->data->self = p_material; diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp index a162f46103..095991e27b 100644 --- a/drivers/unix/dir_access_unix.cpp +++ b/drivers/unix/dir_access_unix.cpp @@ -339,7 +339,7 @@ Error DirAccessUnix::change_dir(String p_dir) { // prev_dir is the directory we are changing out of String prev_dir; char real_current_dir_name[2048]; - ERR_FAIL_COND_V(getcwd(real_current_dir_name, 2048) == nullptr, ERR_BUG); + ERR_FAIL_NULL_V(getcwd(real_current_dir_name, 2048), ERR_BUG); if (prev_dir.parse_utf8(real_current_dir_name) != OK) { prev_dir = real_current_dir_name; //no utf8, maybe latin? } @@ -361,7 +361,7 @@ Error DirAccessUnix::change_dir(String p_dir) { String base = _get_root_path(); if (!base.is_empty() && !try_dir.begins_with(base)) { - ERR_FAIL_COND_V(getcwd(real_current_dir_name, 2048) == nullptr, ERR_BUG); + ERR_FAIL_NULL_V(getcwd(real_current_dir_name, 2048), ERR_BUG); String new_dir; new_dir.parse_utf8(real_current_dir_name); @@ -496,7 +496,7 @@ DirAccessUnix::DirAccessUnix() { // set current directory to an absolute path of the current directory char real_current_dir_name[2048]; - ERR_FAIL_COND(getcwd(real_current_dir_name, 2048) == nullptr); + ERR_FAIL_NULL(getcwd(real_current_dir_name, 2048)); if (current_dir.parse_utf8(real_current_dir_name) != OK) { current_dir = real_current_dir_name; } diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp index 5bf988afb2..890fd7277f 100644 --- a/drivers/vulkan/vulkan_context.cpp +++ b/drivers/vulkan/vulkan_context.cpp @@ -1487,7 +1487,7 @@ Error VulkanContext::_create_physical_device(VkSurfaceKHR p_surface) { #define GET_INSTANCE_PROC_ADDR(inst, entrypoint) \ { \ fp##entrypoint = (PFN_vk##entrypoint)vkGetInstanceProcAddr(inst, "vk" #entrypoint); \ - ERR_FAIL_COND_V_MSG(fp##entrypoint == nullptr, ERR_CANT_CREATE, \ + ERR_FAIL_NULL_V_MSG(fp##entrypoint, ERR_CANT_CREATE, \ "vkGetInstanceProcAddr failed to find vk" #entrypoint); \ } @@ -1689,7 +1689,7 @@ Error VulkanContext::_initialize_queues(VkSurfaceKHR p_surface) { if (!g_gdpa) \ g_gdpa = (PFN_vkGetDeviceProcAddr)vkGetInstanceProcAddr(inst, "vkGetDeviceProcAddr"); \ fp##entrypoint = (PFN_vk##entrypoint)g_gdpa(dev, "vk" #entrypoint); \ - ERR_FAIL_COND_V_MSG(fp##entrypoint == nullptr, ERR_CANT_CREATE, \ + ERR_FAIL_NULL_V_MSG(fp##entrypoint, ERR_CANT_CREATE, \ "vkGetDeviceProcAddr failed to find vk" #entrypoint); \ } diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 8f2b50ebd0..c555ca2109 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -3910,7 +3910,7 @@ void AnimationTrackEditor::insert_value_key(const String &p_property, const Vari ERR_FAIL_NULL(root); ERR_FAIL_COND(history->get_path_size() == 0); Object *obj = ObjectDB::get_instance(history->get_path_object(0)); - ERR_FAIL_COND(!Object::cast_to<Node>(obj)); + ERR_FAIL_NULL(Object::cast_to<Node>(obj)); // Let's build a node path. Node *node = Object::cast_to<Node>(obj); diff --git a/editor/export/export_template_manager.cpp b/editor/export/export_template_manager.cpp index 3a034c8dcc..26ed7c46fb 100644 --- a/editor/export/export_template_manager.cpp +++ b/editor/export/export_template_manager.cpp @@ -686,7 +686,7 @@ Error ExportTemplateManager::install_android_template_from_file(const String &p_ zlib_filefunc_def io = zipio_create_io(&io_fa); unzFile pkg = unzOpen2(p_file.utf8().get_data(), &io); - ERR_FAIL_COND_V_MSG(!pkg, ERR_CANT_OPEN, "Android sources not in ZIP format."); + ERR_FAIL_NULL_V_MSG(pkg, ERR_CANT_OPEN, "Android sources not in ZIP format."); int ret = unzGoToFirstFile(pkg); int total_files = 0; diff --git a/editor/import/collada.cpp b/editor/import/collada.cpp index d27b0aea40..be63973ea7 100644 --- a/editor/import/collada.cpp +++ b/editor/import/collada.cpp @@ -2197,7 +2197,7 @@ bool Collada::_move_geometry_to_skeletons(VisualScene *p_vscene, Node *p_node, L ERR_FAIL_COND_V(!state.scene_map.has(nodeid), false); //weird, it should have it... NodeJoint *nj = dynamic_cast<NodeJoint *>(state.scene_map[nodeid]); ERR_FAIL_NULL_V(nj, false); - ERR_FAIL_COND_V(!nj->owner, false); //weird, node should have a skeleton owner + ERR_FAIL_NULL_V(nj->owner, false); // Weird, node should have a skeleton owner. NodeSkeleton *sk = nj->owner; diff --git a/editor/import/resource_importer_shader_file.cpp b/editor/import/resource_importer_shader_file.cpp index 1275e5b85a..bde2e3d0bf 100644 --- a/editor/import/resource_importer_shader_file.cpp +++ b/editor/import/resource_importer_shader_file.cpp @@ -96,7 +96,7 @@ Error ResourceImporterShaderFile::import(const String &p_source_file, const Stri Error err; Ref<FileAccess> file = FileAccess::open(p_source_file, FileAccess::READ, &err); ERR_FAIL_COND_V(err != OK, ERR_CANT_OPEN); - ERR_FAIL_COND_V(!file.operator->(), ERR_CANT_OPEN); + ERR_FAIL_COND_V(!file.is_valid(), ERR_CANT_OPEN); String file_txt = file->get_as_utf8_string(); Ref<RDShaderFile> shader_file; diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 20c4127c1d..3ba86aa65b 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -779,7 +779,7 @@ void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_fo return; } - ERR_FAIL_COND(!get_tree()); + ERR_FAIL_NULL(get_tree()); HashSet<Ref<Script>> scripts; diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index e6bb5532a3..20b91d8bfd 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -363,7 +363,7 @@ void Skeleton3DEditor::pose_to_rest(const bool p_all_bones) { void Skeleton3DEditor::create_physical_skeleton() { EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton(); - ERR_FAIL_COND(!get_tree()); + ERR_FAIL_NULL(get_tree()); Node *owner = get_tree()->get_edited_scene_root(); const int bone_count = skeleton->get_bone_count(); diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index afc929b547..6bac62d861 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -44,7 +44,7 @@ #include "scene/gui/separator.h" #define CHECK_PLUGIN_INITIALIZED() \ - ERR_FAIL_COND_MSG(!EditorVCSInterface::get_singleton(), "No VCS plugin is initialized. Select a Version Control Plugin from Project menu."); + ERR_FAIL_NULL_MSG(EditorVCSInterface::get_singleton(), "No VCS plugin is initialized. Select a Version Control Plugin from Project menu."); VersionControlEditorPlugin *VersionControlEditorPlugin::singleton = nullptr; diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index e7fe9a353c..b04773d371 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -397,7 +397,7 @@ void ProjectDialog::_nonempty_confirmation_ok_pressed() { } void ProjectDialog::_renderer_selected() { - ERR_FAIL_COND(!renderer_button_group->get_pressed_button()); + ERR_FAIL_NULL(renderer_button_group->get_pressed_button()); String renderer_type = renderer_button_group->get_pressed_button()->get_meta(SNAME("rendering_method")); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index e7727aec4b..31023bf748 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -651,8 +651,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { Node *top_node = selection[i]; Node *bottom_node = selection[selection.size() - 1 - i]; - ERR_FAIL_COND(!top_node->get_parent()); - ERR_FAIL_COND(!bottom_node->get_parent()); + ERR_FAIL_NULL(top_node->get_parent()); + ERR_FAIL_NULL(bottom_node->get_parent()); int bottom_node_pos = bottom_node->get_index(false); int top_node_pos_next = top_node->get_index(false) + (MOVING_DOWN ? 1 : -1); diff --git a/modules/enet/enet_connection.cpp b/modules/enet/enet_connection.cpp index 94473c76c0..1c4f51c665 100644 --- a/modules/enet/enet_connection.cpp +++ b/modules/enet/enet_connection.cpp @@ -252,7 +252,7 @@ int ENetConnection::get_max_channels() const { int ENetConnection::get_local_port() const { ERR_FAIL_NULL_V_MSG(host, 0, "The ENetConnection instance isn't currently active."); - ERR_FAIL_COND_V_MSG(!(host->socket), 0, "The ENetConnection instance isn't currently bound"); + ERR_FAIL_NULL_V_MSG(host->socket, 0, "The ENetConnection instance isn't currently bound."); ENetAddress address; ERR_FAIL_COND_V_MSG(enet_socket_get_address(host->socket, &address), 0, "Unable to get socket address"); return address.port; @@ -344,7 +344,7 @@ void ENetConnection::_broadcast(int p_channel, PackedByteArray p_packet, int p_f void ENetConnection::socket_send(const String &p_address, int p_port, const PackedByteArray &p_packet) { ERR_FAIL_NULL_MSG(host, "The ENetConnection instance isn't currently active."); - ERR_FAIL_COND_MSG(!(host->socket), "The ENetConnection instance isn't currently bound"); + ERR_FAIL_NULL_MSG(host->socket, "The ENetConnection instance isn't currently bound."); ERR_FAIL_COND_MSG(p_port < 1 || p_port > 65535, "The remote port number must be between 1 and 65535 (inclusive)."); IPAddress ip; diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 057c2b49ab..2f0aa010a4 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -5410,7 +5410,7 @@ void GDScriptParser::TreePrinter::print_while(WhileNode *p_while) { } void GDScriptParser::TreePrinter::print_tree(const GDScriptParser &p_parser) { - ERR_FAIL_COND_MSG(p_parser.get_tree() == nullptr, "Parse the code before printing the parse tree."); + ERR_FAIL_NULL_MSG(p_parser.get_tree(), "Parse the code before printing the parse tree."); if (p_parser.is_tool()) { push_line("@tool"); diff --git a/modules/mono/managed_callable.cpp b/modules/mono/managed_callable.cpp index faf3ae7b04..c55c5d8111 100644 --- a/modules/mono/managed_callable.cpp +++ b/modules/mono/managed_callable.cpp @@ -89,7 +89,7 @@ void ManagedCallable::call(const Variant **p_arguments, int p_argcount, Variant r_call_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; // Can't find anything better r_return_value = Variant(); - ERR_FAIL_COND(delegate_handle.value == nullptr); + ERR_FAIL_NULL(delegate_handle.value); GDMonoCache::managed_callbacks.DelegateUtils_InvokeWithVariantArgs( delegate_handle, trampoline, p_arguments, p_argcount, &r_return_value); diff --git a/modules/openxr/util.h b/modules/openxr/util.h index d95bc3bb8e..7488b5cf8e 100644 --- a/modules/openxr/util.h +++ b/modules/openxr/util.h @@ -61,13 +61,13 @@ #define GDEXTENSION_INIT_XR_FUNC(name) \ do { \ name##_ptr = reinterpret_cast<PFN_##name>(get_openxr_api()->get_instance_proc_addr(#name)); \ - ERR_FAIL_COND(name##_ptr == nullptr); \ + ERR_FAIL_NULL(name##_ptr); \ } while (0) #define GDEXTENSION_INIT_XR_FUNC_V(name) \ do { \ name##_ptr = reinterpret_cast<PFN_##name>(get_openxr_api()->get_instance_proc_addr(#name)); \ - ERR_FAIL_COND_V(name##_ptr == nullptr, false); \ + ERR_FAIL_NULL_V(name##_ptr, false); \ } while (0) #define EXT_PROTO_XRRESULT_FUNC1(func_name, arg1_type, arg1) \ diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index b605b29f84..2e994f277d 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -4084,7 +4084,7 @@ bool TextServerAdvanced::_shaped_text_add_string(const RID &p_shaped, const Stri MutexLock lock(sd->mutex); for (int i = 0; i < p_fonts.size(); i++) { - ERR_FAIL_COND_V(!_get_font_data(p_fonts[i]), false); + ERR_FAIL_NULL_V(_get_font_data(p_fonts[i]), false); } if (p_text.is_empty()) { diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp index 0cfbf7f530..2d2fe08798 100644 --- a/modules/text_server_fb/text_server_fb.cpp +++ b/modules/text_server_fb/text_server_fb.cpp @@ -2939,7 +2939,7 @@ bool TextServerFallback::_shaped_text_add_string(const RID &p_shaped, const Stri ERR_FAIL_COND_V(p_size <= 0, false); for (int i = 0; i < p_fonts.size(); i++) { - ERR_FAIL_COND_V(!_get_font_data(p_fonts[i]), false); + ERR_FAIL_NULL_V(_get_font_data(p_fonts[i]), false); } if (p_text.is_empty()) { diff --git a/platform/ios/display_server_ios.mm b/platform/ios/display_server_ios.mm index 8508b67f1e..2561c1c095 100644 --- a/platform/ios/display_server_ios.mm +++ b/platform/ios/display_server_ios.mm @@ -317,37 +317,37 @@ String DisplayServerIOS::get_name() const { } bool DisplayServerIOS::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 isSpeaking]; } bool DisplayServerIOS::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 isPaused]; } TypedArray<Dictionary> DisplayServerIOS::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 getVoices]; } void DisplayServerIOS::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 voice:p_voice volume:p_volume pitch:p_pitch rate:p_rate utterance_id:p_utterance_id interrupt:p_interrupt]; } void DisplayServerIOS::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 pauseSpeaking]; } void DisplayServerIOS::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 resumeSpeaking]; } void DisplayServerIOS::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 stopSpeaking]; } diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index 02a5208e11..81e741d7e2 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -2874,7 +2874,7 @@ void DisplayServerX11::cursor_set_custom_image(const Ref<Resource> &p_cursor, Cu *(cursor_image->pixels + index) = image->get_pixel(column_index, row_index).to_argb32(); } - ERR_FAIL_COND(cursor_image->pixels == nullptr); + ERR_FAIL_NULL(cursor_image->pixels); // Save it for a further usage cursors[p_shape] = XcursorImageLoadCursor(x11_display, cursor_image); diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index 0989e47b19..b314f2fd44 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -118,7 +118,7 @@ DisplayServerMacOS::WindowID DisplayServerMacOS::_create_window(WindowMode p_mod WindowData wd; wd.window_delegate = [[GodotWindowDelegate alloc] init]; - ERR_FAIL_COND_V_MSG(wd.window_delegate == nil, INVALID_WINDOW_ID, "Can't create a window delegate"); + ERR_FAIL_NULL_V_MSG(wd.window_delegate, INVALID_WINDOW_ID, "Can't create a window delegate"); [wd.window_delegate setWindowID:window_id_counter]; int rq_screen = get_screen_from_rect(p_rect); @@ -144,11 +144,11 @@ DisplayServerMacOS::WindowID DisplayServerMacOS::_create_window(WindowMode p_mod styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable backing:NSBackingStoreBuffered defer:NO]; - ERR_FAIL_COND_V_MSG(wd.window_object == nil, INVALID_WINDOW_ID, "Can't create a window"); + ERR_FAIL_NULL_V_MSG(wd.window_object, INVALID_WINDOW_ID, "Can't create a window"); [wd.window_object setWindowID:window_id_counter]; wd.window_view = [[GodotContentView alloc] init]; - ERR_FAIL_COND_V_MSG(wd.window_view == nil, INVALID_WINDOW_ID, "Can't create a window view"); + ERR_FAIL_NULL_V_MSG(wd.window_view, INVALID_WINDOW_ID, "Can't create a window view"); [wd.window_view setWindowID:window_id_counter]; [wd.window_view setWantsLayer:TRUE]; @@ -567,7 +567,7 @@ NSImage *DisplayServerMacOS::_convert_to_nsimg(Ref<Image> &p_image) const { colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:int(p_image->get_width()) * 4 bitsPerPixel:32]; - ERR_FAIL_COND_V(imgrep == nil, nil); + ERR_FAIL_NULL_V(imgrep, nil); uint8_t *pixels = [imgrep bitmapData]; int len = p_image->get_width() * p_image->get_height(); @@ -583,7 +583,7 @@ NSImage *DisplayServerMacOS::_convert_to_nsimg(Ref<Image> &p_image) const { } NSImage *nsimg = [[NSImage alloc] initWithSize:NSMakeSize(p_image->get_width(), p_image->get_height())]; - ERR_FAIL_COND_V(nsimg == nil, nil); + ERR_FAIL_NULL_V(nsimg, nil); [nsimg addRepresentation:imgrep]; return nsimg; } @@ -1574,7 +1574,7 @@ void DisplayServerMacOS::global_menu_set_item_hover_callbacks(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->hover_callback = p_callback; } } @@ -3858,7 +3858,7 @@ void DisplayServerMacOS::cursor_set_custom_image(const Ref<Resource> &p_cursor, bytesPerRow:int(texture_size.width) * 4 bitsPerPixel:32]; - ERR_FAIL_COND(imgrep == nil); + ERR_FAIL_NULL(imgrep); uint8_t *pixels = [imgrep bitmapData]; int len = int(texture_size.width * texture_size.height); @@ -4124,7 +4124,7 @@ void DisplayServerMacOS::set_icon(const Ref<Image> &p_icon) { colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:img->get_width() * 4 bitsPerPixel:32]; - ERR_FAIL_COND(imgrep == nil); + ERR_FAIL_NULL(imgrep); uint8_t *pixels = [imgrep bitmapData]; int len = img->get_width() * img->get_height(); @@ -4140,7 +4140,7 @@ void DisplayServerMacOS::set_icon(const Ref<Image> &p_icon) { } NSImage *nsimg = [[NSImage alloc] initWithSize:NSMakeSize(img->get_width(), img->get_height())]; - ERR_FAIL_COND(nsimg == nil); + ERR_FAIL_NULL(nsimg); [nsimg addRepresentation:imgrep]; [NSApp setApplicationIconImage:nsimg]; diff --git a/platform/macos/gl_manager_macos_legacy.mm b/platform/macos/gl_manager_macos_legacy.mm index 3e5a96bffd..701de6df78 100644 --- a/platform/macos/gl_manager_macos_legacy.mm +++ b/platform/macos/gl_manager_macos_legacy.mm @@ -50,10 +50,10 @@ Error GLManagerLegacy_MacOS::create_context(GLWindow &win) { }; NSOpenGLPixelFormat *pixel_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; - ERR_FAIL_COND_V(pixel_format == nil, ERR_CANT_CREATE); + ERR_FAIL_NULL_V(pixel_format, ERR_CANT_CREATE); win.context = [[NSOpenGLContext alloc] initWithFormat:pixel_format shareContext:shared_context]; - ERR_FAIL_COND_V(win.context == nil, ERR_CANT_CREATE); + ERR_FAIL_NULL_V(win.context, ERR_CANT_CREATE); if (shared_context == nullptr) { shared_context = win.context; } diff --git a/platform/macos/os_macos.mm b/platform/macos/os_macos.mm index 1b8ca0134d..29dff683d5 100644 --- a/platform/macos/os_macos.mm +++ b/platform/macos/os_macos.mm @@ -819,7 +819,7 @@ OS_MacOS::OS_MacOS() { [NSApp finishLaunching]; id delegate = [[GodotApplicationDelegate alloc] init]; - ERR_FAIL_COND(!delegate); + ERR_FAIL_NULL(delegate); [NSApp setDelegate:delegate]; pre_wait_observer = CFRunLoopObserverCreate(kCFAllocatorDefault, kCFRunLoopBeforeWaiting, true, 0, &pre_wait_observer_cb, nullptr); diff --git a/platform/web/javascript_bridge_singleton.cpp b/platform/web/javascript_bridge_singleton.cpp index 1bb72456e8..5d2123cda8 100644 --- a/platform/web/javascript_bridge_singleton.cpp +++ b/platform/web/javascript_bridge_singleton.cpp @@ -163,7 +163,7 @@ void JavaScriptObjectImpl::_get_property_list(List<PropertyInfo> *p_list) const } void JavaScriptObjectImpl::_free_lock(void **p_lock, int p_type) { - ERR_FAIL_COND_MSG(*p_lock == nullptr, "No lock to free!"); + ERR_FAIL_NULL_MSG(*p_lock, "No lock to free!"); const Variant::Type type = (Variant::Type)p_type; switch (type) { case Variant::STRING: { diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 2d4f2cbceb..b3285d4cfc 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -544,12 +544,12 @@ bool AnimationPlayer::is_valid() const { } double AnimationPlayer::get_current_animation_position() const { - ERR_FAIL_COND_V_MSG(!playback.current.from, 0, "AnimationPlayer has no current animation"); + ERR_FAIL_NULL_V_MSG(playback.current.from, 0, "AnimationPlayer has no current animation."); return playback.current.pos; } double AnimationPlayer::get_current_animation_length() const { - ERR_FAIL_COND_V_MSG(!playback.current.from, 0, "AnimationPlayer has no current animation"); + ERR_FAIL_NULL_V_MSG(playback.current.from, 0, "AnimationPlayer has no current animation."); return playback.current.from->animation->get_length(); } diff --git a/scene/gui/graph_element.cpp b/scene/gui/graph_element.cpp index 5129fdd135..7fa5b0ceec 100644 --- a/scene/gui/graph_element.cpp +++ b/scene/gui/graph_element.cpp @@ -150,7 +150,7 @@ void GraphElement::gui_input(const Ref<InputEvent> &p_ev) { Ref<InputEventMouseButton> mb = p_ev; if (mb.is_valid()) { - ERR_FAIL_COND_MSG(get_parent_control() == nullptr, "GraphElement must be the child of a GraphEdit node."); + ERR_FAIL_NULL_MSG(get_parent_control(), "GraphElement must be the child of a GraphEdit node."); if (mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) { Vector2 mpos = mb->get_position(); diff --git a/scene/main/node.h b/scene/main/node.h index 2a45b70139..94c6893170 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -411,7 +411,7 @@ public: Window *get_last_exclusive_window() const; _FORCE_INLINE_ SceneTree *get_tree() const { - ERR_FAIL_COND_V(!data.tree, nullptr); + ERR_FAIL_NULL_V(data.tree, nullptr); return data.tree; } diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 4f82c6cb2d..fd5aa65428 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2734,7 +2734,7 @@ Viewport::SubWindowResize Viewport::_sub_window_get_resize_margin(Window *p_subw bool Viewport::_sub_windows_forward_input(const Ref<InputEvent> &p_event) { if (gui.subwindow_drag != SUB_WINDOW_DRAG_DISABLED) { - ERR_FAIL_COND_V(gui.currently_dragged_subwindow == nullptr, false); + ERR_FAIL_NULL_V(gui.currently_dragged_subwindow, false); Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) { diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 71ec9b29c5..2c28dc31d6 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -779,7 +779,7 @@ void Window::set_visible(bool p_visible) { return; } - ERR_FAIL_COND_MSG(get_parent() == nullptr, "Can't change visibility of main window."); + ERR_FAIL_NULL_MSG(get_parent(), "Can't change visibility of main window."); visible = p_visible; diff --git a/scene/resources/skeleton_modification_2d_physicalbones.cpp b/scene/resources/skeleton_modification_2d_physicalbones.cpp index 520b2ce483..5a72eb6bd8 100644 --- a/scene/resources/skeleton_modification_2d_physicalbones.cpp +++ b/scene/resources/skeleton_modification_2d_physicalbones.cpp @@ -186,7 +186,7 @@ void SkeletonModification2DPhysicalBones::set_physical_bone_chain_length(int p_l void SkeletonModification2DPhysicalBones::fetch_physical_bones() { ERR_FAIL_NULL_MSG(stack, "No modification stack found! Cannot fetch physical bones!"); - ERR_FAIL_COND_MSG(!stack->skeleton, "No skeleton found! Cannot fetch physical bones!"); + ERR_FAIL_NULL_MSG(stack->skeleton, "No skeleton found! Cannot fetch physical bones!"); physical_bone_chain.clear(); diff --git a/servers/physics_2d/godot_area_2d.cpp b/servers/physics_2d/godot_area_2d.cpp index 5371bccf26..d6c786706c 100644 --- a/servers/physics_2d/godot_area_2d.cpp +++ b/servers/physics_2d/godot_area_2d.cpp @@ -180,7 +180,7 @@ Variant GodotArea2D::get_param(PhysicsServer2D::AreaParameter p_param) const { } void GodotArea2D::_queue_monitor_update() { - ERR_FAIL_COND(!get_space()); + ERR_FAIL_NULL(get_space()); if (!monitor_query_list.in_list()) { get_space()->area_add_to_monitor_query_list(&monitor_query_list); diff --git a/servers/physics_2d/godot_body_2d.cpp b/servers/physics_2d/godot_body_2d.cpp index bd472a04ae..12c3e1e5b4 100644 --- a/servers/physics_2d/godot_body_2d.cpp +++ b/servers/physics_2d/godot_body_2d.cpp @@ -422,7 +422,7 @@ void GodotBody2D::integrate_forces(real_t p_step) { return; } - ERR_FAIL_COND(!get_space()); + ERR_FAIL_NULL(get_space()); int ac = areas.size(); diff --git a/servers/physics_2d/godot_physics_server_2d.cpp b/servers/physics_2d/godot_physics_server_2d.cpp index 112ba240b6..8df17992ea 100644 --- a/servers/physics_2d/godot_physics_server_2d.cpp +++ b/servers/physics_2d/godot_physics_server_2d.cpp @@ -994,7 +994,7 @@ void GodotPhysicsServer2D::body_set_pickable(RID p_body, bool p_pickable) { bool GodotPhysicsServer2D::body_test_motion(RID p_body, const MotionParameters &p_parameters, MotionResult *r_result) { GodotBody2D *body = body_owner.get_or_null(p_body); ERR_FAIL_NULL_V(body, false); - ERR_FAIL_COND_V(!body->get_space(), false); + ERR_FAIL_NULL_V(body->get_space(), false); ERR_FAIL_COND_V(body->get_space()->is_locked(), false); _update_shapes(); diff --git a/servers/physics_3d/godot_area_3d.cpp b/servers/physics_3d/godot_area_3d.cpp index 3583443467..d0b287b058 100644 --- a/servers/physics_3d/godot_area_3d.cpp +++ b/servers/physics_3d/godot_area_3d.cpp @@ -211,7 +211,7 @@ Variant GodotArea3D::get_param(PhysicsServer3D::AreaParameter p_param) const { } void GodotArea3D::_queue_monitor_update() { - ERR_FAIL_COND(!get_space()); + ERR_FAIL_NULL(get_space()); if (!monitor_query_list.in_list()) { get_space()->area_add_to_monitor_query_list(&monitor_query_list); diff --git a/servers/physics_3d/godot_body_3d.cpp b/servers/physics_3d/godot_body_3d.cpp index 14975777a6..e102d0f3c9 100644 --- a/servers/physics_3d/godot_body_3d.cpp +++ b/servers/physics_3d/godot_body_3d.cpp @@ -477,7 +477,7 @@ void GodotBody3D::integrate_forces(real_t p_step) { return; } - ERR_FAIL_COND(!get_space()); + ERR_FAIL_NULL(get_space()); int ac = areas.size(); diff --git a/servers/physics_3d/godot_physics_server_3d.cpp b/servers/physics_3d/godot_physics_server_3d.cpp index 4118a19f10..8a7b4e0f07 100644 --- a/servers/physics_3d/godot_physics_server_3d.cpp +++ b/servers/physics_3d/godot_physics_server_3d.cpp @@ -912,7 +912,7 @@ void GodotPhysicsServer3D::body_set_ray_pickable(RID p_body, bool p_enable) { bool GodotPhysicsServer3D::body_test_motion(RID p_body, const MotionParameters &p_parameters, MotionResult *r_result) { GodotBody3D *body = body_owner.get_or_null(p_body); ERR_FAIL_NULL_V(body, false); - ERR_FAIL_COND_V(!body->get_space(), false); + ERR_FAIL_NULL_V(body->get_space(), false); ERR_FAIL_COND_V(body->get_space()->is_locked(), false); _update_shapes(); @@ -1225,7 +1225,7 @@ void GodotPhysicsServer3D::joint_make_pin(RID p_joint, RID p_body_A, const Vecto ERR_FAIL_NULL(body_A); if (!p_body_B.is_valid()) { - ERR_FAIL_COND(!body_A->get_space()); + ERR_FAIL_NULL(body_A->get_space()); p_body_B = body_A->get_space()->get_static_global_body(); } @@ -1297,7 +1297,7 @@ void GodotPhysicsServer3D::joint_make_hinge(RID p_joint, RID p_body_A, const Tra ERR_FAIL_NULL(body_A); if (!p_body_B.is_valid()) { - ERR_FAIL_COND(!body_A->get_space()); + ERR_FAIL_NULL(body_A->get_space()); p_body_B = body_A->get_space()->get_static_global_body(); } @@ -1321,7 +1321,7 @@ void GodotPhysicsServer3D::joint_make_hinge_simple(RID p_joint, RID p_body_A, co ERR_FAIL_NULL(body_A); if (!p_body_B.is_valid()) { - ERR_FAIL_COND(!body_A->get_space()); + ERR_FAIL_NULL(body_A->get_space()); p_body_B = body_A->get_space()->get_static_global_body(); } @@ -1422,7 +1422,7 @@ void GodotPhysicsServer3D::joint_make_slider(RID p_joint, RID p_body_A, const Tr ERR_FAIL_NULL(body_A); if (!p_body_B.is_valid()) { - ERR_FAIL_COND(!body_A->get_space()); + ERR_FAIL_NULL(body_A->get_space()); p_body_B = body_A->get_space()->get_static_global_body(); } @@ -1462,7 +1462,7 @@ void GodotPhysicsServer3D::joint_make_cone_twist(RID p_joint, RID p_body_A, cons ERR_FAIL_NULL(body_A); if (!p_body_B.is_valid()) { - ERR_FAIL_COND(!body_A->get_space()); + ERR_FAIL_NULL(body_A->get_space()); p_body_B = body_A->get_space()->get_static_global_body(); } @@ -1502,7 +1502,7 @@ void GodotPhysicsServer3D::joint_make_generic_6dof(RID p_joint, RID p_body_A, co ERR_FAIL_NULL(body_A); if (!p_body_B.is_valid()) { - ERR_FAIL_COND(!body_A->get_space()); + ERR_FAIL_NULL(body_A->get_space()); p_body_B = body_A->get_space()->get_static_global_body(); } diff --git a/servers/physics_3d/godot_soft_body_3d.cpp b/servers/physics_3d/godot_soft_body_3d.cpp index 20b19ab243..0c2b935554 100644 --- a/servers/physics_3d/godot_soft_body_3d.cpp +++ b/servers/physics_3d/godot_soft_body_3d.cpp @@ -967,7 +967,7 @@ Vector3 GodotSoftBody3D::_compute_area_windforce(const GodotArea3D *p_area, cons void GodotSoftBody3D::predict_motion(real_t p_delta) { const real_t inv_delta = 1.0 / p_delta; - ERR_FAIL_COND(!get_space()); + ERR_FAIL_NULL(get_space()); bool gravity_done = false; Vector3 gravity; diff --git a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp index 3bd35c53cc..2e8c9d7f8e 100644 --- a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp @@ -2115,7 +2115,7 @@ void MaterialStorage::material_set_shader(RID p_material, RID p_shader) { return; } - ERR_FAIL_COND(shader->data == nullptr); + ERR_FAIL_NULL(shader->data); material->data = material_data_request_func[shader->type](shader->data); material->data->self = p_material; diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index 34ffc1e90f..d4e2fee277 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -1377,7 +1377,7 @@ bool ShaderLanguage::_find_identifier(const BlockNode *p_block, bool p_allow_rea if (p_allow_reassign) { break; } - ERR_FAIL_COND_V(!p_block->parent_block, false); + ERR_FAIL_NULL_V(p_block->parent_block, false); p_block = p_block->parent_block; } } diff --git a/thirdparty/enet/godot.cpp b/thirdparty/enet/godot.cpp index 37239e8462..ecf0a7e6dd 100644 --- a/thirdparty/enet/godot.cpp +++ b/thirdparty/enet/godot.cpp @@ -458,7 +458,7 @@ int enet_host_dtls_client_setup(ENetHost *host, const char *p_for_hostname, void } void enet_host_refuse_new_connections(ENetHost *host, int p_refuse) { - ERR_FAIL_COND(!host->socket); + ERR_FAIL_NULL(host->socket); ((ENetGodotSocket *)host->socket)->set_refuse_new_connections(p_refuse); } |