[squash] apply stronger testing to config:get/3
Project: http://git-wip-us.apache.org/repos/asf/couchdb-config/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-config/commit/ee652d2e Tree: http://git-wip-us.apache.org/repos/asf/couchdb-config/tree/ee652d2e Diff: http://git-wip-us.apache.org/repos/asf/couchdb-config/diff/ee652d2e Branch: refs/heads/2708-stronger-testing-for-config-set Commit: ee652d2ee00ab5b9afea28c2a2a529e4eacf4195 Parents: 6566dd4 Author: Mike Wallace <mikewall...@apache.org> Authored: Wed Jun 3 12:23:20 2015 +0100 Committer: Mike Wallace <mikewall...@apache.org> Committed: Wed Jun 3 12:37:03 2015 +0100 ---------------------------------------------------------------------- src/config.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-config/blob/ee652d2e/src/config.erl ---------------------------------------------------------------------- diff --git a/src/config.erl b/src/config.erl index 301d4e1..908dee7 100644 --- a/src/config.erl +++ b/src/config.erl @@ -137,7 +137,9 @@ get(Section, Key) -> get(Section, Key, Default) when is_binary(Section) and is_binary(Key) -> ?MODULE:get(binary_to_list(Section), binary_to_list(Key), Default); -get(Section, Key, Default) when is_list(Section), is_list(Key) -> +get(Section, Key, Default) -> + assert_string(Section), + assert_string(Key), case ets:lookup(?MODULE, {Section, Key}) of [] when Default == undefined -> Default; [] when is_boolean(Default) -> Default;