Check for empty children after dropping overlapping ranges.

Before this changes, the logic checked for empty children before
DropRangesThatOverlapNonOwned in CoalesceOwnedMemory.

This could lead to a NULL added to the children vector, which will
later lead to a crash.  Instead check after drop ranges.

Change-Id: I54793bd536adec7289d02ef477877f57ef1ab958
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2906378
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
GitOrigin-RevId: 161a84977b319baf7819c9527da427809169aa45
diff --git a/minidump/minidump_memory_writer.cc b/minidump/minidump_memory_writer.cc
index 868c356..a3b1f75 100644
--- a/minidump/minidump_memory_writer.cc
+++ b/minidump/minidump_memory_writer.cc
@@ -172,11 +172,11 @@
 }
 
 void MinidumpMemoryListWriter::CoalesceOwnedMemory() {
+  DropRangesThatOverlapNonOwned();
+
   if (children_.empty())
     return;
 
-  DropRangesThatOverlapNonOwned();
-
   std::sort(children_.begin(),
             children_.end(),
             [](const std::unique_ptr<SnapshotMinidumpMemoryWriter>& a_ptr,