summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2012-02-02 22:50:32 +0100
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2012-02-02 22:54:40 +0100
commita176db6937e62cbae43086a729bf47c76214cbd6 (patch)
treea847462c8225c2b343d0282c6d3aa2730e1e6b6d
parentfe1652e13718889b3e561aea5f688ab58a696774 (diff)
Fix Dialyzer (race condition) warning
-rw-r--r--src/rebar_utils.erl9
1 files changed, 5 insertions, 4 deletions
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