From 02bef1ae2b4eee20c2d5ecb5dd5a5dd8f0f6596c Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 2 Feb 2021 17:38:32 +0200 Subject: [PATCH] vdoc: fix segfault on `v doc -m -f html vlib` --- cmd/tools/vtest-parser.v | 2 +- vlib/v/doc/doc.v | 2 +- vlib/v/pref/default.v | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/tools/vtest-parser.v b/cmd/tools/vtest-parser.v index c6e5bf353c..2c7dfc30b3 100644 --- a/cmd/tools/vtest-parser.v +++ b/cmd/tools/vtest-parser.v @@ -97,7 +97,7 @@ fn main() { fn process_cli_args() &Context { mut context := &Context{ - pref: 0 + pref: pref.new_preferences() } context.myself = os.executable() mut fp := flag.new_flag_parser(os.args_after('test-parser')) diff --git a/vlib/v/doc/doc.v b/vlib/v/doc/doc.v index c137bdcf7e..3907f6b8bb 100644 --- a/vlib/v/doc/doc.v +++ b/vlib/v/doc/doc.v @@ -113,7 +113,7 @@ pub fn new(input_path string) Doc { time_generated: time.now() } d.fmt = fmt.Fmt{ - pref: 0 + pref: d.prefs indent: 0 is_debug: false table: d.table diff --git a/vlib/v/pref/default.v b/vlib/v/pref/default.v index a8df86f89f..15f958d04c 100644 --- a/vlib/v/pref/default.v +++ b/vlib/v/pref/default.v @@ -10,8 +10,8 @@ pub const ( default_module_path = os.vmodules_dir() ) -pub fn new_preferences() Preferences { - mut p := Preferences{} +pub fn new_preferences() &Preferences { + mut p := &Preferences{} p.fill_with_defaults() return p }