* Check data size before trying to translate it into a picture image
* Remove leftover debug traces git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40778 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
8b921e3650
commit
d25cab17b0
@ -458,9 +458,6 @@ PictureView::_BeginDrag(BPoint sourcePoint)
|
||||
void
|
||||
PictureView::_HandleDrop(BMessage* msg)
|
||||
{
|
||||
printf("PictureControl::_HandleDrop(): \n");
|
||||
msg->PrintToStream();
|
||||
|
||||
entry_ref dirRef;
|
||||
BString name, type;
|
||||
bool saveToFile = msg->FindString("be:filetypes", &type) == B_OK
|
||||
@ -483,7 +480,7 @@ PictureView::_HandleDrop(BMessage* msg)
|
||||
|
||||
BBitmapStream stream(bitmap);
|
||||
|
||||
// find transaltion format asked for
|
||||
// find translation format we're asked for
|
||||
translator_info* outInfo;
|
||||
int32 outNumInfo;
|
||||
bool found = false;
|
||||
@ -543,7 +540,7 @@ PictureView::_HandleDrop(BMessage* msg)
|
||||
}
|
||||
}
|
||||
|
||||
// Detach, as we don't want our picture to be deleted
|
||||
// Detach, as we don't want our fPicture to be deleted
|
||||
stream.DetachBitmap(&bitmap);
|
||||
}
|
||||
|
||||
@ -556,6 +553,15 @@ PictureView::_LoadPicture(const entry_ref* ref)
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
off_t fileSize;
|
||||
status = file.GetSize(&fileSize);
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
// Check that we've at least some data to translate...
|
||||
if (fileSize < 1)
|
||||
return B_OK;
|
||||
|
||||
translator_info info;
|
||||
memset(&info, 0, sizeof(translator_info));
|
||||
BMessage ioExtension;
|
||||
@ -583,7 +589,7 @@ PictureView::_LoadPicture(const entry_ref* ref)
|
||||
if (picture == NULL)
|
||||
return B_ERROR;
|
||||
|
||||
// Remember image format so we store using same
|
||||
// Remember image format so we could store using the same
|
||||
fPictureMIMEType = info.MIME;
|
||||
fPictureType = info.type;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user