From cfa8d762ef8c513faa73b7f08074858475127921 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Thu, 29 Jan 2026 01:51:36 +0100 Subject: [PATCH] Fix UPNP code sample using `OK` constant incorrectly The returned value is an UPNPResult, not an Error. Both `UPNP.UPNP_RESULT_SUCCESS` and `OK` are equal to 0, so it will behave the same, but it's not identical from a static typing perspective. --- modules/upnp/doc_classes/UPNP.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/upnp/doc_classes/UPNP.xml b/modules/upnp/doc_classes/UPNP.xml index 15436f4eb8a..47938ef4274 100644 --- a/modules/upnp/doc_classes/UPNP.xml +++ b/modules/upnp/doc_classes/UPNP.xml @@ -29,7 +29,7 @@ var upnp = UPNP.new() var err = upnp.discover() - if err != OK: + if err != UPNP.UPNP_RESULT_SUCCESS: push_error(str(err)) upnp_completed.emit(err) return @@ -37,7 +37,7 @@ if upnp.get_gateway() and upnp.get_gateway().is_valid_gateway(): upnp.add_port_mapping(server_port, server_port, ProjectSettings.get_setting("application/config/name"), "UDP") upnp.add_port_mapping(server_port, server_port, ProjectSettings.get_setting("application/config/name"), "TCP") - upnp_completed.emit(OK) + upnp_completed.emit(UPNP.UPNP_RESULT_SUCCESS) func _ready(): thread = Thread.new()