apps/icon-o-matic: Fix null pointer dereference in export window

* Bailing early in SavePanel constructor is pretty bad and creates
  a bunch of NULL pointers things later try and reference.
* HScrollview and VScrollview no longer exist after migrating to
  using the layout kit.

Change-Id: Ia80d68508246f952547fb687e29029304a8ffd1e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3507
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Alexander von Gluck IV 2020-12-14 20:02:55 -06:00 committed by Alex von Gluck IV
parent 03ee0e55ca
commit 69b1d7ac94

View File

@ -83,10 +83,8 @@ SavePanel::SavePanel(const char* name,
BButton* cancel = dynamic_cast<BButton*>(
background->FindView("cancel button"));
BView* textview = background->FindView("text view");
BScrollBar* hscrollbar = dynamic_cast<BScrollBar*>(
background->FindView("HScrollBar"));
if (!cancel || !textview || !hscrollbar) {
if (!cancel || !textview) {
printf("SavePanel::SavePanel() - couldn't find necessary controls.\n");
return;
}
@ -114,10 +112,6 @@ SavePanel::SavePanel(const char* name,
// move up them up the height of the menu field
BView *poseview = background->FindView("PoseView");
if (poseview) poseview->ResizeBy(0, -height);
BButton *insert = (BButton *)background->FindView("default button");
if (hscrollbar) hscrollbar->MoveBy(0, -height);
BScrollBar *vscrollbar = (BScrollBar *)background->FindView("VScrollBar");
if (vscrollbar) vscrollbar->ResizeBy(0, -height);
BView *countvw = (BView *)background->FindView("CountVw");
if (countvw) countvw->MoveBy(0, -height);
textview->MoveBy(0, -height);
@ -145,6 +139,8 @@ SavePanel::SavePanel(const char* name,
textview->ResizeTo(fSettingsB->Frame().right - fFormatMF->Frame().left,
textview->Frame().Height());
BButton *insert = (BButton *)background->FindView("default button");
// Make sure the smallest window won't draw the "Settings" button over
// anything else
float minWindowWidth = textview->Bounds().Width()