summaryrefslogtreecommitdiff
path: root/Applications
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-09-28 18:38:27 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-09-28 18:38:27 +0200
commit09ad58f837dfbc520f5bf287e38b6cbb696a95b3 (patch)
treead9b3b77b2efcf3a43c633945abf03c071327973 /Applications
parent02ee8cbbe2f16d7da15c9b6454e5217fc2e7438a (diff)
downloadserenity-09ad58f837dfbc520f5bf287e38b6cbb696a95b3.zip
Help: Don't crash on startup when non-md man pages are present :^)
Diffstat (limited to 'Applications')
-rw-r--r--Applications/Help/ManualSectionNode.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/Applications/Help/ManualSectionNode.cpp b/Applications/Help/ManualSectionNode.cpp
index 17e1ed3a51..5e80cd4ade 100644
--- a/Applications/Help/ManualSectionNode.cpp
+++ b/Applications/Help/ManualSectionNode.cpp
@@ -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));
}