mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 19:15:07 +00:00
Help: Don't crash on startup when non-md man pages are present :^)
This commit is contained in:
parent
02ee8cbbe2
commit
09ad58f837
1 changed files with 5 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
|||
#include "ManualSectionNode.h"
|
||||
#include "ManualPageNode.h"
|
||||
#include <AK/FileSystemPath.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/CDirIterator.h>
|
||||
|
||||
|
@ -17,9 +18,10 @@ void ManualSectionNode::reify_if_needed() const
|
|||
CDirIterator dir_iter { path(), CDirIterator::Flags::SkipDots };
|
||||
|
||||
while (dir_iter.has_next()) {
|
||||
String file_name = dir_iter.next_path();
|
||||
ASSERT(file_name.ends_with(".md"));
|
||||
String page_name = file_name.substring(0, file_name.length() - 3);
|
||||
FileSystemPath file_path(dir_iter.next_path());
|
||||
if (file_path.extension() != "md")
|
||||
continue;
|
||||
String page_name = file_path.title();
|
||||
NonnullOwnPtr<ManualNode> child = make<ManualPageNode>(*this, move(page_name));
|
||||
m_children.append(move(child));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue