Skip to content

Commit

Permalink
upstr: Add null checks to XSSFSheet.RemoveHyperlink method
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Koloskov committed Aug 24, 2023
1 parent 92dfb28 commit 5f01090
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ooxml/XSSF/UserModel/XSSFSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3014,7 +3014,14 @@ public void RemoveHyperlink(int row, int column)
XSSFHyperlink hyperlink = hyperlinks[index];
if (hyperlink.CellRef.Equals(ref1))
{
worksheet.hyperlinks.hyperlink.Remove(hyperlink.GetCTHyperlink());
if (worksheet != null
&& worksheet.hyperlinks != null
&& worksheet.hyperlinks.hyperlink != null
&& worksheet.hyperlinks.hyperlink.Contains(hyperlink.GetCTHyperlink()))
{
worksheet.hyperlinks.hyperlink.Remove(hyperlink.GetCTHyperlink());
}

hyperlinks.RemoveAt(index);
return;
}
Expand Down

0 comments on commit 5f01090

Please sign in to comment.