Avoid passing nullptr to CFWL_WidgetMgr::NextTab().

NextTab() expects its parent parameter to be non-null.

BUG=chromium:976429

Change-Id: Ib83f0962f1e6f8d7fc458c08009a5db5d1540512
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/56514
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp
index 3114733..614b71e 100644
--- a/xfa/fwl/cfwl_notedriver.cpp
+++ b/xfa/fwl/cfwl_notedriver.cpp
@@ -174,9 +174,12 @@
     if (m_pFocus && pWidgetMgr->GetSystemFormWidget(m_pFocus.Get()) != pForm)
       pFocus = nullptr;
 
-    CFWL_Widget* pNextTabStop = CFWL_WidgetMgr::NextTab(pForm, pFocus);
-    if (!pNextTabStop)
-      pNextTabStop = CFWL_WidgetMgr::NextTab(pForm, nullptr);
+    CFWL_Widget* pNextTabStop = nullptr;
+    if (pForm) {
+      pNextTabStop = CFWL_WidgetMgr::NextTab(pForm, pFocus);
+      if (!pNextTabStop)
+        pNextTabStop = CFWL_WidgetMgr::NextTab(pForm, nullptr);
+    }
     if (pNextTabStop == pFocus)
       return true;
     if (pNextTabStop)