Address late comments on go/aog/1269207

Address a pair of comments on go/aog/1269207. This adds a requested
comment clarification and a missing OOM check.

Test: ./test.py --host
Bug: 152339121
Change-Id: I127dd10db2c01b338171e49ee968ea3593a01c5e
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 27bdfe6..284f19f 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -5048,7 +5048,12 @@
     }
   }
   const size_t num_virtual_methods = proxied_methods.size();
-  // We also need to filter out the 'throws'
+  // We also need to filter out the 'throws'. The 'throws' are a Class[][] that
+  // contains an array of all the classes each function is declared to throw.
+  // This is used to wrap unexpected exceptions in a
+  // UndeclaredThrowableException exception. This array is in the same order as
+  // the methods array and like the methods array must be filtered to remove any
+  // non-proxied methods.
   const bool has_filtered_methods =
       static_cast<int32_t>(num_virtual_methods) != h_methods->GetLength();
   MutableHandle<mirror::ObjectArray<mirror::ObjectArray<mirror::Class>>> original_proxied_throws(
@@ -5059,6 +5064,10 @@
               ? mirror::ObjectArray<mirror::ObjectArray<mirror::Class>>::Alloc(
                     self, original_proxied_throws->GetClass(), num_virtual_methods)
               : original_proxied_throws.Get()));
+  if (proxied_throws.IsNull() && !original_proxied_throws.IsNull()) {
+    self->AssertPendingOOMException();
+    return nullptr;
+  }
   if (has_filtered_methods) {
     for (auto [orig_idx, new_idx] : ZipCount(MakeIterationRange(proxied_throws_idx))) {
       DCHECK_LE(new_idx, orig_idx);