You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2020/01/28 17:26:09 UTC

[mynewt-newt] 05/09: config: Handle case where config tree lacks a root

This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git

commit 7bb99e866462ef485e1e659c9534fb9de5416d1b
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Mon Jan 27 11:03:03 2020 -0800

    config: Handle case where config tree lacks a root
---
 newt/config/tree.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/newt/config/tree.go b/newt/config/tree.go
index d7e3dc8..7750cb6 100644
--- a/newt/config/tree.go
+++ b/newt/config/tree.go
@@ -87,6 +87,11 @@ func BuildTree(entries []FileEntry) (*Node, error) {
 		}
 	}
 
+	if root == nil {
+		return nil, util.FmtNewtError(
+			"failed to build a config tree: no root file")
+	}
+
 	SortTree(root)
 	return root, nil
 }