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:
@@ -84,9 +84,7 @@ BSeparatorView::BSeparatorView(BMessage* archive)
|
|||||||
B_ALIGN_VERTICAL_CENTER)),
|
B_ALIGN_VERTICAL_CENTER)),
|
||||||
fBorder(B_FANCY_BORDER)
|
fBorder(B_FANCY_BORDER)
|
||||||
{
|
{
|
||||||
// TODO: Test this.
|
// NULL archives will be caught by BView.
|
||||||
if (archive == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const char* label;
|
const char* label;
|
||||||
if (archive->FindString("_labelview", &label) == B_OK) {
|
if (archive->FindString("_labelview", &label) == B_OK) {
|
||||||
|
|||||||
@@ -405,6 +405,8 @@ BView::BView(BMessage* archive)
|
|||||||
BHandler(BUnarchiver::PrepareArchive(archive))
|
BHandler(BUnarchiver::PrepareArchive(archive))
|
||||||
{
|
{
|
||||||
BUnarchiver unarchiver(archive);
|
BUnarchiver unarchiver(archive);
|
||||||
|
if (!archive)
|
||||||
|
debugger("BView cannot be constructed from a NULL archive.");
|
||||||
|
|
||||||
BRect frame;
|
BRect frame;
|
||||||
archive->FindRect("_frame", &frame);
|
archive->FindRect("_frame", &frame);
|
||||||
|
|||||||
@@ -511,6 +511,9 @@ BUnarchiver::IsArchiveManaged(const BMessage* archive)
|
|||||||
if (BManagerBase::ManagerPointer(archive))
|
if (BManagerBase::ManagerPointer(archive))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (!archive)
|
||||||
|
return false;
|
||||||
|
|
||||||
// managed top level archives return here
|
// managed top level archives return here
|
||||||
bool dummy;
|
bool dummy;
|
||||||
if (archive->FindBool(kManagedField, &dummy) == B_OK)
|
if (archive->FindBool(kManagedField, &dummy) == B_OK)
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ public:
|
|||||||
static BManagerBase*
|
static BManagerBase*
|
||||||
ManagerPointer(const BMessage* constArchive)
|
ManagerPointer(const BMessage* constArchive)
|
||||||
{
|
{
|
||||||
|
if (!constArchive)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
BMessage* archive = const_cast<BMessage*>(constArchive);
|
BMessage* archive = const_cast<BMessage*>(constArchive);
|
||||||
|
|
||||||
return static_cast<BManagerBase*>(
|
return static_cast<BManagerBase*>(
|
||||||
|
|||||||
Reference in New Issue
Block a user