Check that UIT_GetWebView() is non-NULL before dereferencing (issue #441).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@401 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2011-12-01 17:11:45 +00:00
parent 9fd169d16c
commit 47217b00d4
3 changed files with 30 additions and 15 deletions

View File

@ -296,7 +296,8 @@ void BrowserWebViewDelegate::startDragging(
const WebImage& image, const WebImage& image,
const WebPoint& image_offset) { const WebPoint& image_offset) {
// TODO(port): Support drag and drop. // TODO(port): Support drag and drop.
browser_->UIT_GetWebView()->dragSourceSystemDragEnded(); if (browser_->UIT_GetWebView())
browser_->UIT_GetWebView()->dragSourceSystemDragEnded();
} }
void BrowserWebViewDelegate::runModal() { void BrowserWebViewDelegate::runModal() {

View File

@ -534,7 +534,8 @@ void BrowserWebViewDelegate::RevokeDragDrop() {
} }
void BrowserWebViewDelegate::EndDragging() { void BrowserWebViewDelegate::EndDragging() {
browser_->UIT_GetWebView()->dragSourceSystemDragEnded(); if (browser_->UIT_GetWebView())
browser_->UIT_GetWebView()->dragSourceSystemDragEnded();
drag_delegate_ = NULL; drag_delegate_ = NULL;
} }

View File

@ -95,11 +95,16 @@ DWORD WebDropTarget::OnDragEnter(IDataObject* data_object,
POINT client_pt = cursor_position; POINT client_pt = cursor_position;
ScreenToClient(GetHWND(), &client_pt); ScreenToClient(GetHWND(), &client_pt);
WebDragOperation operation = browser_->UIT_GetWebView()->dragTargetDragEnter( WebDragOperation operation;
drop_data.ToDragData(), if (browser_->UIT_GetWebView()) {
WebPoint(client_pt.x, client_pt.y), operation = browser_->UIT_GetWebView()->dragTargetDragEnter(
WebPoint(cursor_position.x, cursor_position.y), drop_data.ToDragData(),
mask); WebPoint(client_pt.x, client_pt.y),
WebPoint(cursor_position.x, cursor_position.y),
mask);
} else {
operation = WebDragOperationNone;
}
return web_drag_utils_win::WebDragOpToWinDragOp(operation); return web_drag_utils_win::WebDragOpToWinDragOp(operation);
} }
@ -117,10 +122,15 @@ DWORD WebDropTarget::OnDragOver(IDataObject* data_object,
POINT client_pt = cursor_position; POINT client_pt = cursor_position;
ScreenToClient(GetHWND(), &client_pt); ScreenToClient(GetHWND(), &client_pt);
WebDragOperation operation = browser_->UIT_GetWebView()->dragTargetDragOver( WebDragOperation operation;
WebPoint(client_pt.x, client_pt.y), if (browser_->UIT_GetWebView()) {
WebPoint(cursor_position.x, cursor_position.y), browser_->UIT_GetWebView()->dragTargetDragOver(
web_drag_utils_win::WinDragOpMaskToWebDragOpMask(effects)); WebPoint(client_pt.x, client_pt.y),
WebPoint(cursor_position.x, cursor_position.y),
web_drag_utils_win::WinDragOpMaskToWebDragOpMask(effects));
} else {
operation = WebDragOperationNone;
}
return web_drag_utils_win::WebDragOpToWinDragOp(operation); return web_drag_utils_win::WebDragOpToWinDragOp(operation);
} }
@ -133,7 +143,8 @@ void WebDropTarget::OnDragLeave(IDataObject* data_object) {
if (canceled_) if (canceled_)
return; return;
browser_->UIT_GetWebView()->dragTargetDragLeave(); if (browser_->UIT_GetWebView())
browser_->UIT_GetWebView()->dragTargetDragLeave();
} }
DWORD WebDropTarget::OnDrop(IDataObject* data_object, DWORD WebDropTarget::OnDrop(IDataObject* data_object,
@ -148,9 +159,11 @@ DWORD WebDropTarget::OnDrop(IDataObject* data_object,
ScreenToClient(GetHWND(), &client_pt); ScreenToClient(GetHWND(), &client_pt);
browser_->set_is_dropping(true); browser_->set_is_dropping(true);
browser_->UIT_GetWebView()->dragTargetDrop( if (browser_->UIT_GetWebView()) {
WebPoint(client_pt.x, client_pt.y), browser_->UIT_GetWebView()->dragTargetDrop(
WebPoint(cursor_position.x, cursor_position.y)); WebPoint(client_pt.x, client_pt.y),
WebPoint(cursor_position.x, cursor_position.y));
}
browser_->set_is_dropping(false); browser_->set_is_dropping(false);
current_wvh_ = NULL; current_wvh_ = NULL;