Fix another nullptr dereference.

In this case, if the .eh_frame_hdr doesn't exist, we would crash.

Bug: 68813077

Test: Pass new unit tests, verified that without the fix, the unit test
Test: would crash.
Change-Id: I4f1365a76fe5c2fb69fa106a1ef15889c14e7611
diff --git a/libunwindstack/tests/DwarfEhFrameWithHdrTest.cpp b/libunwindstack/tests/DwarfEhFrameWithHdrTest.cpp
index 7c8fc6c..1028ab9 100644
--- a/libunwindstack/tests/DwarfEhFrameWithHdrTest.cpp
+++ b/libunwindstack/tests/DwarfEhFrameWithHdrTest.cpp
@@ -205,6 +205,14 @@
   }
 }
 
+TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeOffsetBinary_index_fail) {
+  this->eh_frame_->TestSetTableEntrySize(0x10);
+  this->eh_frame_->TestSetFdeCount(10);
+
+  uint64_t fde_offset;
+  EXPECT_FALSE(this->eh_frame_->GetFdeOffsetBinary(0x1000, &fde_offset, 10));
+}
+
 TYPED_TEST_P(DwarfEhFrameWithHdrTest, GetFdeOffsetSequential) {
   this->eh_frame_->TestSetFdeCount(10);
   this->eh_frame_->TestSetEntriesDataOffset(0x100);
@@ -414,10 +422,11 @@
 REGISTER_TYPED_TEST_CASE_P(DwarfEhFrameWithHdrTest, Init, GetFdeInfoFromIndex_expect_cache_fail,
                            GetFdeInfoFromIndex_read_pcrel, GetFdeInfoFromIndex_read_datarel,
                            GetFdeInfoFromIndex_cached, GetFdeOffsetBinary_verify,
-                           GetFdeOffsetSequential, GetFdeOffsetSequential_last_element,
-                           GetFdeOffsetSequential_end_check, GetFdeOffsetFromPc_fail_fde_count,
-                           GetFdeOffsetFromPc_binary_search, GetFdeOffsetFromPc_sequential_search,
-                           GetCieFde32, GetCieFde64, GetFdeFromPc_fde_not_found);
+                           GetFdeOffsetBinary_index_fail, GetFdeOffsetSequential,
+                           GetFdeOffsetSequential_last_element, GetFdeOffsetSequential_end_check,
+                           GetFdeOffsetFromPc_fail_fde_count, GetFdeOffsetFromPc_binary_search,
+                           GetFdeOffsetFromPc_sequential_search, GetCieFde32, GetCieFde64,
+                           GetFdeFromPc_fde_not_found);
 
 typedef ::testing::Types<uint32_t, uint64_t> DwarfEhFrameWithHdrTestTypes;
 INSTANTIATE_TYPED_TEST_CASE_P(, DwarfEhFrameWithHdrTest, DwarfEhFrameWithHdrTestTypes);