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.

(cherry picked from commit cfa8d762ef8c513faa73b7f08074858475127921)
This commit is contained in:
Hugo Locurcio
2026-01-29 01:51:36 +01:00
committed by Thaddeus Crews
parent d8d4e7cb7c
commit cd9d78acfc
+2 -2
View File
@@ -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()