From a176db6937e62cbae43086a729bf47c76214cbd6 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Thu, 2 Feb 2012 22:50:32 +0100 Subject: Fix Dialyzer (race condition) warning --- src/rebar_utils.erl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index afb8c00..113dd21 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl @@ -190,10 +190,11 @@ expand_env_variable(InStr, VarName, RawVarValue) -> vcs_vsn(Vcs, Dir) -> Key = {Vcs, Dir}, - case ets:lookup(rebar_vsn_cache, Key) of - [{Key, VsnString}] -> - VsnString; - [] -> + try ets:lookup_element(rebar_vsn_cache, Key, 2) of + VsnString -> + VsnString + catch + error:badarg -> VsnString = vcs_vsn_1(Vcs, Dir), ets:insert(rebar_vsn_cache, {Key, VsnString}), VsnString -- cgit v1.1