Keymap: Check return value of get_ref_for_path
if not B_OK, create BFilePanels with default directory This should never happen but better than crashing on a NULL ref
This commit is contained in:
parent
e85c33517c
commit
14698e0432
@ -133,17 +133,23 @@ KeymapWindow::KeymapWindow()
|
||||
path.Append("Keymap");
|
||||
|
||||
entry_ref ref;
|
||||
get_ref_for_path(path.Path(), &ref);
|
||||
if (get_ref_for_path(path.Path(), &ref) == B_OK) {
|
||||
BDirectory userKeymapsDir(&ref);
|
||||
if (userKeymapsDir.InitCheck() != B_OK)
|
||||
create_directory(path.Path(), S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
|
||||
BDirectory userKeymapsDir(&ref);
|
||||
if (userKeymapsDir.InitCheck() != B_OK)
|
||||
create_directory(path.Path(), S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
|
||||
BMessenger messenger(this);
|
||||
fOpenPanel = new BFilePanel(B_OPEN_PANEL, &messenger, &ref,
|
||||
B_FILE_NODE, false, NULL);
|
||||
fSavePanel = new BFilePanel(B_SAVE_PANEL, &messenger, &ref,
|
||||
B_FILE_NODE, false, NULL);
|
||||
BMessenger messenger(this);
|
||||
fOpenPanel = new BFilePanel(B_OPEN_PANEL, &messenger, &ref,
|
||||
B_FILE_NODE, false, NULL);
|
||||
fSavePanel = new BFilePanel(B_SAVE_PANEL, &messenger, &ref,
|
||||
B_FILE_NODE, false, NULL);
|
||||
} else {
|
||||
BMessenger messenger(this);
|
||||
fOpenPanel = new BFilePanel(B_OPEN_PANEL, &messenger, NULL,
|
||||
B_FILE_NODE, false, NULL);
|
||||
fSavePanel = new BFilePanel(B_SAVE_PANEL, &messenger, NULL,
|
||||
B_FILE_NODE, false, NULL);
|
||||
}
|
||||
|
||||
BRect windowFrame;
|
||||
BString keyboardLayout;
|
||||
|
Loading…
x
Reference in New Issue
Block a user