Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check text exists before accessing it #4395

Merged
merged 3 commits into from
Dec 8, 2024
Merged

Conversation

nicodh
Copy link
Contributor

@nicodh nicodh commented Dec 8, 2024

resolves #4337

@nicodh nicodh requested a review from WofWca December 8, 2024 07:34
nonInteractiveContent
/>
</div>
{hasMessage && quote.text && (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this hide the quote when quote.kind === 'JustText'? Because hasMessage is defined as quote.kind === 'WithMessage'.

And I think we need a comment for the quote.text && check, at least link the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So now I check only for the text property to exist.

And I think we need a comment for the quote.text && check, at least link the issue

I think it is self explaining to check for the text property to exist before calling "slice" on it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the thing is that the types say that it always exists.

nonInteractiveContent
/>
</div>
{quote.text && (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{quote.text && (
{/* `quote.text` might be `undefined` due to
https://github.com/deltachat/deltachat-desktop/issues/4337#issuecomment-2473521298 */}
{quote.text && (

@nicodh nicodh merged commit d0b1ddd into main Dec 8, 2024
7 of 8 checks passed
@nicodh nicodh deleted the fix-4337-crash-on-quote-reply branch December 8, 2024 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1.48.0 crashes sometimes when i try to quote-reply
2 participants