1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:28:11 +00:00

LibDiff: Make Diff::parse_hunks fallible

Currently the only error that can happen is an OOM. However, in the
future there may be other errors that this function may throw, such as
detecting an invalid patch.
This commit is contained in:
Shannon Booth 2023-06-24 12:44:22 +12:00 committed by Andreas Kling
parent dbd838efdf
commit 23df5748f6
4 changed files with 10 additions and 9 deletions

View file

@ -134,7 +134,7 @@ Gfx::IntRect DiffViewer::separator_rect() const
void DiffViewer::set_content(DeprecatedString const& original, DeprecatedString const& diff)
{
m_original_lines = split_to_lines(original);
m_hunks = Diff::parse_hunks(diff);
m_hunks = Diff::parse_hunks(diff).release_value_but_fixme_should_propagate_errors();
if constexpr (DIFF_DEBUG) {
for (size_t i = 0; i < m_original_lines.size(); ++i)
@ -149,7 +149,7 @@ DiffViewer::DiffViewer()
DiffViewer::DiffViewer(DeprecatedString const& original, DeprecatedString const& diff)
: m_original_lines(split_to_lines(original))
, m_hunks(Diff::parse_hunks(diff))
, m_hunks(Diff::parse_hunks(diff).release_value_but_fixme_should_propagate_errors())
{
setup_properties();
}