Only replace original render callback if not set #272
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue link
https://app.asana.com/0/1206316631984075/1207645749086440/f
Description
parse_blocks can crash beacuse of an infinite loop.
Somehow for the image block the constructor can be called twice, resulting in the original render callback beeing the same as the render callback.
Because they became the same, the following call to fallback to the original render callback if no custom callback is available, will then cause an infinite loop (because render callback is calling the same render callback,etc).
This solution aims to solve this by only allowing the original render callback to be set once.
It's the original, so that should always be allright.
How Has This Been Tested?
In a project, by running parse_blocks with an image block in the content present.
Screenshots (if appropriate):
Types of changes
Checklist: