Avoid null CFWL_Message checks in OnProcessMessage.
The entrance to this chain of calls is in SendMessageToFWLWidget(),
which takes a unique_ptr, and is always called with the result
of make_unique<>.
Change-Id: I1892bb368241b135c4f53c0b612d80129d994d5f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/72772
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp
index 912130b..458fb45 100644
--- a/xfa/fwl/cfwl_checkbox.cpp
+++ b/xfa/fwl/cfwl_checkbox.cpp
@@ -189,9 +189,6 @@
}
void CFWL_CheckBox::OnProcessMessage(CFWL_Message* pMessage) {
- if (!pMessage)
- return;
-
switch (pMessage->GetType()) {
case CFWL_Message::Type::kSetFocus:
OnFocusChanged(true);
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp
index f1b52f0..1e7fdbc 100644
--- a/xfa/fwl/cfwl_combobox.cpp
+++ b/xfa/fwl/cfwl_combobox.cpp
@@ -395,9 +395,6 @@
}
void CFWL_ComboBox::OnProcessMessage(CFWL_Message* pMessage) {
- if (!pMessage)
- return;
-
bool backDefault = true;
switch (pMessage->GetType()) {
case CFWL_Message::Type::kSetFocus: {
diff --git a/xfa/fwl/cfwl_comboedit.cpp b/xfa/fwl/cfwl_comboedit.cpp
index a8ac57f..0b5beac 100644
--- a/xfa/fwl/cfwl_comboedit.cpp
+++ b/xfa/fwl/cfwl_comboedit.cpp
@@ -42,9 +42,6 @@
}
void CFWL_ComboEdit::OnProcessMessage(CFWL_Message* pMessage) {
- if (!pMessage)
- return;
-
bool backDefault = true;
switch (pMessage->GetType()) {
case CFWL_Message::Type::kSetFocus: {
diff --git a/xfa/fwl/cfwl_combolist.cpp b/xfa/fwl/cfwl_combolist.cpp
index e78977b..46f6e9c 100644
--- a/xfa/fwl/cfwl_combolist.cpp
+++ b/xfa/fwl/cfwl_combolist.cpp
@@ -69,9 +69,6 @@
}
void CFWL_ComboList::OnProcessMessage(CFWL_Message* pMessage) {
- if (!pMessage)
- return;
-
CFWL_Message::Type type = pMessage->GetType();
bool backDefault = true;
if (type == CFWL_Message::Type::kSetFocus ||
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp
index 60fb199..c27bb07 100644
--- a/xfa/fwl/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/cfwl_datetimepicker.cpp
@@ -310,9 +310,6 @@
}
void CFWL_DateTimePicker::OnProcessMessage(CFWL_Message* pMessage) {
- if (!pMessage)
- return;
-
switch (pMessage->GetType()) {
case CFWL_Message::Type::kSetFocus:
OnFocusChanged(pMessage, true);
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index c39727c..c5b4b74 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -959,9 +959,6 @@
}
void CFWL_Edit::OnProcessMessage(CFWL_Message* pMessage) {
- if (!pMessage)
- return;
-
switch (pMessage->GetType()) {
case CFWL_Message::Type::kSetFocus:
OnFocusChanged(pMessage, true);
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp
index 08e9f0c..c5992ad 100644
--- a/xfa/fwl/cfwl_listbox.cpp
+++ b/xfa/fwl/cfwl_listbox.cpp
@@ -619,8 +619,6 @@
}
void CFWL_ListBox::OnProcessMessage(CFWL_Message* pMessage) {
- if (!pMessage)
- return;
if (!IsEnabled())
return;
diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp
index 8dc6b51..49f9f74 100644
--- a/xfa/fwl/cfwl_monthcalendar.cpp
+++ b/xfa/fwl/cfwl_monthcalendar.cpp
@@ -645,9 +645,6 @@
}
void CFWL_MonthCalendar::OnProcessMessage(CFWL_Message* pMessage) {
- if (!pMessage)
- return;
-
switch (pMessage->GetType()) {
case CFWL_Message::Type::kSetFocus:
case CFWL_Message::Type::kKillFocus:
diff --git a/xfa/fwl/cfwl_pushbutton.cpp b/xfa/fwl/cfwl_pushbutton.cpp
index e78e6d8..9e7d470 100644
--- a/xfa/fwl/cfwl_pushbutton.cpp
+++ b/xfa/fwl/cfwl_pushbutton.cpp
@@ -85,8 +85,6 @@
}
void CFWL_PushButton::OnProcessMessage(CFWL_Message* pMessage) {
- if (!pMessage)
- return;
if (!IsEnabled())
return;
diff --git a/xfa/fwl/cfwl_scrollbar.cpp b/xfa/fwl/cfwl_scrollbar.cpp
index 9b6aade..000c10d 100644
--- a/xfa/fwl/cfwl_scrollbar.cpp
+++ b/xfa/fwl/cfwl_scrollbar.cpp
@@ -294,9 +294,6 @@
}
void CFWL_ScrollBar::OnProcessMessage(CFWL_Message* pMessage) {
- if (!pMessage)
- return;
-
CFWL_Message::Type type = pMessage->GetType();
if (type == CFWL_Message::Type::kMouse) {
CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index 046f401..3b4e04c 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -764,6 +764,7 @@
void CXFA_FFField::SendMessageToFWLWidget(
std::unique_ptr<CFWL_Message> pMessage) {
+ ASSERT(pMessage);
GetApp()->GetFWLWidgetMgr()->OnProcessMessageToForm(std::move(pMessage));
}