From 48c06f42140009808141d68afd73a936c3b05d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 22 Oct 2009 14:00:17 +0000 Subject: [PATCH] * _GetCharacterAt() might actually fail - this fixes a bug causing the bitmap initialization to fail. This also caused a crash, as that wasn't checked for before. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33729 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/charactermap/CharacterView.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/apps/charactermap/CharacterView.cpp b/src/apps/charactermap/CharacterView.cpp index 382a94b39a..01826b2afb 100644 --- a/src/apps/charactermap/CharacterView.cpp +++ b/src/apps/charactermap/CharacterView.cpp @@ -303,12 +303,17 @@ CharacterView::MouseMoved(BPoint where, uint32 transit, // Update character - we want to drag the one we originally clicked // on, not the one the mouse might be over now. - _GetCharacterAt(fClickPoint, character, &frame); + if (!_GetCharacterAt(fClickPoint, character, &frame)) + return; BPoint offset = fClickPoint - frame.LeftTop(); frame.OffsetTo(B_ORIGIN); BBitmap* bitmap = new BBitmap(frame, B_BITMAP_ACCEPTS_VIEWS, B_RGBA32); + if (bitmap->InitCheck() != B_OK) { + delete bitmap; + return; + } bitmap->Lock(); BView* view = new BView(frame, "drag", 0, 0);