Fix crash when trying to open a non-existing file.
This commit is contained in:
@@ -43,6 +43,7 @@ status_t
|
|||||||
BFileRequest::_ProtocolLoop()
|
BFileRequest::_ProtocolLoop()
|
||||||
{
|
{
|
||||||
BNode node(fUrl.Path().String());
|
BNode node(fUrl.Path().String());
|
||||||
|
|
||||||
if (node.IsSymLink()) {
|
if (node.IsSymLink()) {
|
||||||
// Traverse the symlink and start over
|
// Traverse the symlink and start over
|
||||||
BEntry entry(fUrl.Path().String(), true);
|
BEntry entry(fUrl.Path().String(), true);
|
||||||
@@ -84,12 +85,14 @@ BFileRequest::_ProtocolLoop()
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(node.IsDirectory());
|
|
||||||
node_ref ref;
|
node_ref ref;
|
||||||
status_t error = node.GetNodeRef(&ref);
|
status_t error = node.GetNodeRef(&ref);
|
||||||
|
|
||||||
|
// Stop here, and don't hit the assert below, if the file doesn't exist.
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
assert(node.IsDirectory());
|
||||||
BDirectory directory(&ref);
|
BDirectory directory(&ref);
|
||||||
|
|
||||||
fResult.SetContentType("application/x-ftp-directory; charset=utf-8");
|
fResult.SetContentType("application/x-ftp-directory; charset=utf-8");
|
||||||
|
|||||||
Reference in New Issue
Block a user