Page MenuHome

Fix T99316: Crash when no font is in String to Curves in geometry nodes
ClosedPublic

Authored by Iliya Katueshenock (Moder) on Jul 1 2022, 1:47 PM.

Details

Summary


If you remove the default font from the project, the node will not
have the selected font. In this case, there is no check that the font
does not exist. This suggestion adds an error message if the font
is not specified.
This is the report fix: https://developer.blender.org/T99316

Diff Detail

Repository
rB Blender

Event Timeline

Iliya Katueshenock (Moder) requested review of this revision.Jul 1 2022, 1:47 PM
Iliya Katueshenock (Moder) created this revision.
Iliya Katueshenock (Moder) edited the summary of this revision. (Show Details)
Iliya Katueshenock (Moder) edited the summary of this revision. (Show Details)

Changed the diff by adding context

Not sure if we need to complicate it by adding the message to the TextLayout struct. Maybe just check if params.node().id is null instead of layout.stop_message.empty()?

I meant that there might be other error messaging in get_text_layout, but if you think so, then this is not required.

Removed the message field, made a simple check

This revision is now accepted and ready to land.Jul 1 2022, 3:23 PM

Thanks for the patch. I think this can be cleaned up slightly so we don't have to retrieve the font in multiple places.
Since we don't usually use exceptions, I would recommend returning std::optional<TextLayout> from get_text_layout.
The get_text_layout function can add the error message itself after the existing retrieval of the font, and return std::nullopt.
node_geo_exec could check if the optional is empty and return early.

Iliya Katueshenock (Moder) planned changes to this revision.Jul 1 2022, 4:02 PM

Now return is optional

This revision is now accepted and ready to land.Jul 1 2022, 4:34 PM
Iliya Katueshenock (Moder) retitled this revision from Fix: Crash when no font is in String to Curves in geometry nodes to Fix T99316: Crash when no font is in String to Curves in geometry nodes.Jul 1 2022, 8:21 PM