Skip to content

fix: PhrasingElementExpression.cs - check empty string in text element#186

Merged
onizet merged 1 commit intoonizet:devfrom
galyni:check-empty-text
Jan 20, 2025
Merged

fix: PhrasingElementExpression.cs - check empty string in text element#186
onizet merged 1 commit intoonizet:devfrom
galyni:check-empty-text

Conversation

@galyni
Copy link

@galyni galyni commented Jan 20, 2025

I had an error while parsing some (admittedly wrong) html, like the following (I reduced to a minimal example)

<span> <div> <br /> <div> <span>Texte</span> </div> </div> </span>

The error was :

Index was outside the bounds of the array

The submitted code fixed the issue without causing any apparent regression, but I must confess I don't have enough understanding of the internals to assure the modification is needed. I leave that to the appreciation of the reviewer. I figured that, as long as we access the string by index, we should check that it is not empty. My doubts are about what to do if the string is empty.

@sonarqubecloud
Copy link

@onizet onizet merged commit 7e963ff into onizet:dev Jan 20, 2025
1 check passed
@onizet
Copy link
Owner

onizet commented Jan 20, 2025

This is an amazing PR, simple but efficient!

onizet added a commit that referenced this pull request Jan 20, 2025
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.

2 participants