summaryrefslogtreecommitdiffstats
path: root/modules/upnp/upnp.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-09-03 16:13:55 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-09-03 16:13:55 +0200
commitd15de6f264bc3659310c19bc402a432e2ea896e3 (patch)
treedeb293154752257941ca8852de4eec167ff9d3b7 /modules/upnp/upnp.cpp
parentb104f218410669ec81ec9ffd4d8833b8aa30a554 (diff)
parent194bdde94787227e8f53a4e3273c192ab70b03ac (diff)
downloadredot-engine-d15de6f264bc3659310c19bc402a432e2ea896e3.tar.gz
Merge pull request #96292 from AThousandShips/null_check_ref_fix
Cleanup of raw `nullptr` checks with `Ref`
Diffstat (limited to 'modules/upnp/upnp.cpp')
-rw-r--r--modules/upnp/upnp.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/upnp/upnp.cpp b/modules/upnp/upnp.cpp
index 70f0ea346b..6bdb261b50 100644
--- a/modules/upnp/upnp.cpp
+++ b/modules/upnp/upnp.cpp
@@ -229,14 +229,14 @@ Ref<UPNPDevice> UPNP::get_device(int index) const {
}
void UPNP::add_device(Ref<UPNPDevice> device) {
- ERR_FAIL_NULL(device);
+ ERR_FAIL_COND(device.is_null());
devices.push_back(device);
}
void UPNP::set_device(int index, Ref<UPNPDevice> device) {
ERR_FAIL_INDEX(index, devices.size());
- ERR_FAIL_NULL(device);
+ ERR_FAIL_COND(device.is_null());
devices.set(index, device);
}
@@ -257,7 +257,7 @@ Ref<UPNPDevice> UPNP::get_gateway() const {
for (int i = 0; i < devices.size(); i++) {
Ref<UPNPDevice> dev = get_device(i);
- if (dev != nullptr && dev->is_valid_gateway()) {
+ if (dev.is_valid() && dev->is_valid_gateway()) {
return dev;
}
}
@@ -292,7 +292,7 @@ bool UPNP::is_discover_ipv6() const {
String UPNP::query_external_address() const {
Ref<UPNPDevice> dev = get_gateway();
- if (dev == nullptr) {
+ if (dev.is_null()) {
return "";
}
@@ -302,7 +302,7 @@ String UPNP::query_external_address() const {
int UPNP::add_port_mapping(int port, int port_internal, String desc, String proto, int duration) const {
Ref<UPNPDevice> dev = get_gateway();
- if (dev == nullptr) {
+ if (dev.is_null()) {
return UPNP_RESULT_NO_GATEWAY;
}
@@ -312,7 +312,7 @@ int UPNP::add_port_mapping(int port, int port_internal, String desc, String prot
int UPNP::delete_port_mapping(int port, String proto) const {
Ref<UPNPDevice> dev = get_gateway();
- if (dev == nullptr) {
+ if (dev.is_null()) {
return UPNP_RESULT_NO_GATEWAY;
}