Update BView to call debugger when passed a NULL archive for its archive constructor. This means there is no need to check for a NULL archive in BSeparatorView. Also update BUnarchiver and friends to be NULL safe. Pointed out by Adrien, fixes CID 1754.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38063 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alex Wilson 2010-08-12 14:50:57 +00:00
parent 600170807a
commit aa818be69a
4 changed files with 9 additions and 3 deletions

View File

@ -84,9 +84,7 @@ BSeparatorView::BSeparatorView(BMessage* archive)
B_ALIGN_VERTICAL_CENTER)),
fBorder(B_FANCY_BORDER)
{
// TODO: Test this.
if (archive == NULL)
return;
// NULL archives will be caught by BView.
const char* label;
if (archive->FindString("_labelview", &label) == B_OK) {

View File

@ -405,6 +405,8 @@ BView::BView(BMessage* archive)
BHandler(BUnarchiver::PrepareArchive(archive))
{
BUnarchiver unarchiver(archive);
if (!archive)
debugger("BView cannot be constructed from a NULL archive.");
BRect frame;
archive->FindRect("_frame", &frame);

View File

@ -511,6 +511,9 @@ BUnarchiver::IsArchiveManaged(const BMessage* archive)
if (BManagerBase::ManagerPointer(archive))
return true;
if (!archive)
return false;
// managed top level archives return here
bool dummy;
if (archive->FindBool(kManagedField, &dummy) == B_OK)

View File

@ -43,6 +43,9 @@ public:
static BManagerBase*
ManagerPointer(const BMessage* constArchive)
{
if (!constArchive)
return NULL;
BMessage* archive = const_cast<BMessage*>(constArchive);
return static_cast<BManagerBase*>(