From 9bd27033c4786fa89cebc9d090ad2c6e8f47b598 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 6 Mar 2021 15:02:26 +0100 Subject: Allow merging with empty pdiff patches There isn't a lot of sense in working on empty patches as they change nothing (quite literally), but they can be the result of merging multiple patches and so to not require our users to specifically detect and remove them, we can be nice and just ignore them instead of erroring out. --- methods/rred.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'methods') diff --git a/methods/rred.cc b/methods/rred.cc index f53f05ad5..3453bd3bc 100644 --- a/methods/rred.cc +++ b/methods/rred.cc @@ -441,8 +441,12 @@ class Patch { bool cmdwanted = true; Change ch(std::numeric_limits::max()); - if (f.ReadLine(buffer, sizeof(buffer)) == NULL) + if (f.ReadLine(buffer, sizeof(buffer)) == nullptr) + { + if (f.Eof()) + return true; return _error->Error("Reading first line of patchfile %s failed", f.Name().c_str()); + } do { if (h != NULL) h->Add(buffer); -- cgit v1.2.3-70-g09d2