From 0a84f0feb552d797d6af6fe55b7b226fa985752f Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 2 Jun 2020 23:14:46 +0300 Subject: [PATCH] vdoc: prevent infinite recursion in get_parent_mod --- vlib/v/doc/doc.v | 1 + 1 file changed, 1 insertion(+) diff --git a/vlib/v/doc/doc.v b/vlib/v/doc/doc.v index c6d601a114..801e0e9f71 100644 --- a/vlib/v/doc/doc.v +++ b/vlib/v/doc/doc.v @@ -144,6 +144,7 @@ pub fn (nodes []DocNode) find_children_of(parent_type string) []DocNode { } fn get_parent_mod(dir string) ?string { + if dir.len == 0 { return error('root folder reached') } base_dir := os.base_dir(dir) if os.file_name(base_dir) in ['encoding', 'v'] && 'vlib' in base_dir { return os.file_name(base_dir)