diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-03 16:13:55 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-03 16:13:55 +0200 |
commit | d15de6f264bc3659310c19bc402a432e2ea896e3 (patch) | |
tree | deb293154752257941ca8852de4eec167ff9d3b7 /core | |
parent | b104f218410669ec81ec9ffd4d8833b8aa30a554 (diff) | |
parent | 194bdde94787227e8f53a4e3273c192ab70b03ac (diff) | |
download | redot-engine-d15de6f264bc3659310c19bc402a432e2ea896e3.tar.gz |
Merge pull request #96292 from AThousandShips/null_check_ref_fix
Cleanup of raw `nullptr` checks with `Ref`
Diffstat (limited to 'core')
-rw-r--r-- | core/extension/gdextension.cpp | 2 | ||||
-rw-r--r-- | core/io/file_access_encrypted.cpp | 4 | ||||
-rw-r--r-- | core/io/image.cpp | 2 | ||||
-rw-r--r-- | core/io/plist.cpp | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/core/extension/gdextension.cpp b/core/extension/gdextension.cpp index e764b9c112..d4b50facb2 100644 --- a/core/extension/gdextension.cpp +++ b/core/extension/gdextension.cpp @@ -675,7 +675,7 @@ GDExtensionInterfaceFunctionPtr GDExtension::get_interface_function(const String } Error GDExtension::open_library(const String &p_path, const Ref<GDExtensionLoader> &p_loader) { - ERR_FAIL_NULL_V_MSG(p_loader, FAILED, "Can't open GDExtension without a loader."); + ERR_FAIL_COND_V_MSG(p_loader.is_null(), FAILED, "Can't open GDExtension without a loader."); loader = p_loader; Error err = loader->open_library(p_path); diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp index 605c5b2f6f..13d1e0c8fc 100644 --- a/core/io/file_access_encrypted.cpp +++ b/core/io/file_access_encrypted.cpp @@ -37,7 +37,7 @@ #include <stdio.h> Error FileAccessEncrypted::open_and_parse(Ref<FileAccess> p_base, const Vector<uint8_t> &p_key, Mode p_mode, bool p_with_magic) { - ERR_FAIL_COND_V_MSG(file != nullptr, ERR_ALREADY_IN_USE, "Can't open file while another file from path '" + file->get_path_absolute() + "' is open."); + ERR_FAIL_COND_V_MSG(file.is_valid(), ERR_ALREADY_IN_USE, "Can't open file while another file from path '" + file->get_path_absolute() + "' is open."); ERR_FAIL_COND_V(p_key.size() != 32, ERR_INVALID_PARAMETER); pos = 0; @@ -162,7 +162,7 @@ void FileAccessEncrypted::_close() { } bool FileAccessEncrypted::is_open() const { - return file != nullptr; + return file.is_valid(); } String FileAccessEncrypted::get_path() const { diff --git a/core/io/image.cpp b/core/io/image.cpp index f6065d984b..fcbe483e38 100644 --- a/core/io/image.cpp +++ b/core/io/image.cpp @@ -4225,7 +4225,7 @@ Dictionary Image::compute_image_metrics(const Ref<Image> p_compared_image, bool result["root_mean_squared"] = INFINITY; result["peak_snr"] = 0.0f; - ERR_FAIL_NULL_V(p_compared_image, result); + ERR_FAIL_COND_V(p_compared_image.is_null(), result); Error err = OK; Ref<Image> compared_image = duplicate(true); if (compared_image->is_compressed()) { diff --git a/core/io/plist.cpp b/core/io/plist.cpp index 86737609bf..8d91e6dec2 100644 --- a/core/io/plist.cpp +++ b/core/io/plist.cpp @@ -814,7 +814,7 @@ bool PList::load_string(const String &p_string, String &r_err_out) { } PackedByteArray PList::save_asn1() const { - if (root == nullptr) { + if (root.is_null()) { ERR_FAIL_V_MSG(PackedByteArray(), "PList: Invalid PList, no root node."); } size_t size = root->get_asn1_size(1); @@ -848,7 +848,7 @@ PackedByteArray PList::save_asn1() const { } String PList::save_text() const { - if (root == nullptr) { + if (root.is_null()) { ERR_FAIL_V_MSG(String(), "PList: Invalid PList, no root node."); } |