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.
This commit is contained in:
Hugo Locurcio 2026-01-29 01:51:36 +01:00
parent 77579f93e6
commit cfa8d762ef
No known key found for this signature in database
GPG key ID: 46ACE49F61685096

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()