Fix a few static analysis errors.
Issues N1, N2, N8 in https://pvs-studio.com/en/blog/posts/cpp/0893/
xslb was duplicated.
widget's parent was accessed before a subsequent null check.
client_ is DCHECKed to be non-null in the ctor.
BUG=1275942
Change-Id: If127fbf3e757ccf63ec4ce0afa139a4d261499af
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3313879
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Mohamed Amir Yosef <mamir@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#948018}
diff --git a/chrome/common/safe_browsing/download_type_util.cc b/chrome/common/safe_browsing/download_type_util.cc
index 8fdaa67..6023b70 100644
--- a/chrome/common/safe_browsing/download_type_util.cc
+++ b/chrome/common/safe_browsing/download_type_util.cc
@@ -72,7 +72,6 @@
file.MatchesExtension(FILE_PATH_LITERAL(".xldm")) ||
file.MatchesExtension(FILE_PATH_LITERAL(".xltx")) ||
file.MatchesExtension(FILE_PATH_LITERAL(".xltm")) ||
- file.MatchesExtension(FILE_PATH_LITERAL(".xlsb")) ||
file.MatchesExtension(FILE_PATH_LITERAL(".xla")) ||
file.MatchesExtension(FILE_PATH_LITERAL(".xlam")) ||
file.MatchesExtension(FILE_PATH_LITERAL(".xll")) ||
@@ -88,7 +87,6 @@
file.MatchesExtension(FILE_PATH_LITERAL(".ppsx")) ||
file.MatchesExtension(FILE_PATH_LITERAL(".ppsm")) ||
file.MatchesExtension(FILE_PATH_LITERAL(".sldx")) ||
- file.MatchesExtension(FILE_PATH_LITERAL(".xldm")) ||
file.MatchesExtension(FILE_PATH_LITERAL(".rtf")))
return ClientDownloadRequest::DOCUMENT;
diff --git a/components/constrained_window/native_web_contents_modal_dialog_manager_views.cc b/components/constrained_window/native_web_contents_modal_dialog_manager_views.cc
index 5690940f..96c8070 100644
--- a/components/constrained_window/native_web_contents_modal_dialog_manager_views.cc
+++ b/components/constrained_window/native_web_contents_modal_dialog_manager_views.cc
@@ -72,7 +72,7 @@
wm::SetChildWindowVisibilityChangesAnimated(parent);
// No animations should get performed on the window since that will re-order
// the window stack which will then cause many problems.
- if (parent && parent->parent()) {
+ if (parent->parent()) {
parent->parent()->SetProperty(aura::client::kAnimationsDisabledKey, true);
}
diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc
index df71f193..fb2fb49 100644
--- a/components/password_manager/core/browser/password_manager.cc
+++ b/components/password_manager/core/browser/password_manager.cc
@@ -531,7 +531,7 @@
manager ? PasswordManagerMetricsRecorder::FormManagerAvailable::kSuccess
: PasswordManagerMetricsRecorder::FormManagerAvailable::
kMissingManual;
- if (client_ && client_->GetMetricsRecorder())
+ if (client_->GetMetricsRecorder())
client_->GetMetricsRecorder()->RecordFormManagerAvailable(availability);
ShowManualFallbackForSaving(manager, form_data);
@@ -670,7 +670,7 @@
? PasswordManagerMetricsRecorder::FormManagerAvailable::kSuccess
: PasswordManagerMetricsRecorder::FormManagerAvailable::
kMissingProvisionallySave;
- if (client_ && client_->GetMetricsRecorder())
+ if (client_->GetMetricsRecorder())
client_->GetMetricsRecorder()->RecordFormManagerAvailable(availability);
if (!matched_manager) {
@@ -1206,7 +1206,7 @@
logger = std::make_unique<BrowserSavePasswordProgressLogger>(
client_->GetLogManager());
}
- if (client_ && client_->GetMetricsRecorder()) {
+ if (client_->GetMetricsRecorder()) {
client_->GetMetricsRecorder()->RecordProvisionalSaveFailure(
failure, submitted_form_url_, form_origin, logger.get());
}