* Let AddMimeMenu() check if the MIME type is valid, otherwise BMimeType::Type()

could return NULL. This fixes the crashing part of #4037.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31777 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-07-26 16:46:05 +00:00
parent 64ccb6b58a
commit d219b1fcfc

View File

@ -1107,7 +1107,7 @@ BContainerWindow::FrameResized(float, float)
if (scroll != B_ORIGIN) if (scroll != B_ORIGIN)
PoseView()->ScrollBy(scroll.x, scroll.y); PoseView()->ScrollBy(scroll.x, scroll.y);
PoseView()->UpdateScrollRange(); PoseView()->UpdateScrollRange();
PoseView()->ResetPosePlacementHint(); PoseView()->ResetPosePlacementHint();
} }
@ -3172,6 +3172,9 @@ BMenu*
BContainerWindow::AddMimeMenu(const BMimeType& mimeType, bool isSuperType, BContainerWindow::AddMimeMenu(const BMimeType& mimeType, bool isSuperType,
BMenu* menu, int32 start) BMenu* menu, int32 start)
{ {
if (!mimeType.IsValid())
return NULL;
// Check if we already have an entry for this MIME type in the menu. // Check if we already have an entry for this MIME type in the menu.
for (int32 i = start; BMenuItem* item = menu->ItemAt(i); i++) { for (int32 i = start; BMenuItem* item = menu->ItemAt(i); i++) {
BMessage* message = item->Message(); BMessage* message = item->Message();