Skip to content

Crash when trying to format rid via % #107603

Closed
@smedelyan

Description

@smedelyan

Tested versions

Reproducible in 4.4.1-stable

System information

Godot v4.4.1.stable (3cb2f7d3c) - Windows 10 (build 19045) - Multi-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1660 (NVIDIA; 32.0.15.7270) - AMD Ryzen 7 2700X Eight-Core Processor (16 threads)

Issue description

RID-s (maybe some other types as well, I don't know) can't be formatted to strings via "%s" % my_rid. It causes crash

Steps to reproduce

Try the following script on some node and hit test button:

@tool
extends Node


@export var region: NavigationRegion3D
@export_tool_button("Test % formatting") var button: Callable = _test_formatting


func _test_formatting() -> void:
	# won't compile, says: Invalid operands to operator %, String and RID
	#print("what about rid? %" % RID()) 
	
	# prints:
	# what about RID? RID(0)
	print("what about rid? %s" % [RID()]) 
	
	# CRASHES silently (stack trace in console does not point to anywhere)
	print("what about rid? %s" % region.get_rid()) 
	
	# CRASHES silently (stack trace in console does not point to anywhere)
	var rid := region.get_rid()
	print("what about rid? %s" % rid) 

	# this one is funny: just wrap it with [], and you're fine
	# prints
	# what about rid? RID(803571201212416)
	print("what about rid? %s" % [region.get_rid()]) 

When you try to attach with a debugger, it finally leads to here:
Image

Minimal reproduction project (MRP)

see script above

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions