summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-22 18:23:44 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-22 18:23:44 +0000
commitb7d060862667150a87fc90939d79aec35a2c0c01 (patch)
tree7bd9cb2d2ec5ac1bdaa22998c0f97faa8a9e1485
parentcbbab32703eef756639d57c643f1dc2284a5fb75 (diff)
downloadchromium_src-b7d060862667150a87fc90939d79aec35a2c0c01.zip
chromium_src-b7d060862667150a87fc90939d79aec35a2c0c01.tar.gz
chromium_src-b7d060862667150a87fc90939d79aec35a2c0c01.tar.bz2
Fix 3 PVS Studio warnings.
In two files, pNPWindow was dereferenced way before it's checked for NULL. Remove the NULL check, it apparently isn't hit in practice. In the automation test, move a null check for "browser" up a bit. BUG=271530 R=phajdan.jr@chromium.org Review URL: https://codereview.chromium.org/23102011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219052 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc8
-rw-r--r--content/test/plugin/plugin_window_size_test.cc2
-rw-r--r--content/test/plugin/plugin_windowed_test.cc2
3 files changed, 6 insertions, 6 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index f2c995d..064df01 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -5458,16 +5458,16 @@ void TestingAutomationProvider::IsPageActionVisible(
return;
}
Browser* browser = automation_util::GetBrowserForTab(tab);
+ if (!browser) {
+ reply.SendError("Tab does not belong to an open browser");
+ return;
+ }
const Extension* extension;
if (!GetEnabledExtensionFromJSONArgs(
args, "extension_id", browser->profile(), &extension, &error)) {
reply.SendError(error);
return;
}
- if (!browser) {
- reply.SendError("Tab does not belong to an open browser");
- return;
- }
ExtensionAction* page_action =
ExtensionActionManager::Get(browser->profile())->
GetPageAction(*extension);
diff --git a/content/test/plugin/plugin_window_size_test.cc b/content/test/plugin/plugin_window_size_test.cc
index 701b58a..06cecf7 100644
--- a/content/test/plugin/plugin_window_size_test.cc
+++ b/content/test/plugin/plugin_window_size_test.cc
@@ -17,7 +17,7 @@ NPError PluginWindowSizeTest::SetWindow(NPWindow* pNPWindow) {
return NPERR_NO_ERROR;
HWND window = reinterpret_cast<HWND>(pNPWindow->window);
- if (!pNPWindow || !::IsWindow(window)) {
+ if (!::IsWindow(window)) {
SetError("Invalid arguments passed in");
return NPERR_INVALID_PARAM;
}
diff --git a/content/test/plugin/plugin_windowed_test.cc b/content/test/plugin/plugin_windowed_test.cc
index 150d256..a795857 100644
--- a/content/test/plugin/plugin_windowed_test.cc
+++ b/content/test/plugin/plugin_windowed_test.cc
@@ -32,7 +32,7 @@ NPError WindowedPluginTest::SetWindow(NPWindow* pNPWindow) {
return NPERR_NO_ERROR;
HWND parent = reinterpret_cast<HWND>(pNPWindow->window);
- if (!pNPWindow || !::IsWindow(parent)) {
+ if (!::IsWindow(parent)) {
SetError("Invalid arguments passed in");
return NPERR_INVALID_PARAM;
}