fix: prevent crash when endPDF is called twice#475
Open
SergeySD wants to merge 1 commit intojulianhille:developfrom
Open
fix: prevent crash when endPDF is called twice#475SergeySD wants to merge 1 commit intojulianhille:developfrom
SergeySD wants to merge 1 commit intojulianhille:developfrom
Conversation
Add guard to throw a descriptive error instead of causing a segmentation fault when endPDF is called multiple times.
julianhille
reviewed
Dec 18, 2025
Comment on lines
+221
to
+224
| if (this._pdfEnded) { | ||
| throw new Error("endPDF has already been called"); | ||
| } | ||
| this._pdfEnded = true; |
Owner
There was a problem hiding this comment.
isnt this just a patch on a broken leg?? :>
like if it has a segmentation fault if this.writer.end is called this is just preventing for receipe this error and for no one else.
What i'm saying is i'm not sure if this is a proper fix will look into it. thank you very much for you pull request anyway.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
endPDF()multiple times on a Recipe instanceTest plan
npm test- all 172 tests passtests/recipe/endPDF-twice.jsverifies error is thrown on second call