1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vdoc: fix a panic on v doc -s modname with an empty module

This commit is contained in:
Delyan Angelov 2020-06-20 19:33:44 +03:00
parent 37927235cd
commit 8a6beac692

View File

@ -127,9 +127,15 @@ fn open_url(url string) {
} }
fn (mut cfg DocConfig) serve_html() { fn (mut cfg DocConfig) serve_html() {
server_url := 'http://localhost:' + cfg.server_port.str()
docs := cfg.render() docs := cfg.render()
dkeys := docs.keys()
if dkeys.len < 1 {
eprintln('no documentation created, the module has no `pub` functions')
exit(1)
}
def_name := docs.keys()[0] def_name := docs.keys()[0]
//
server_url := 'http://localhost:' + cfg.server_port.str()
server := net.listen(cfg.server_port) or { server := net.listen(cfg.server_port) or {
panic(err) panic(err)
} }