diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2010-09-22 21:09:40 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2010-09-22 21:09:40 -0300 |
commit | 885f344eec59d0e56aa244b8a490ef7c29f72129 (patch) | |
tree | eeec90f0c67ce41abc2eab36da98b410fc6cc26f | |
parent | 36b614082373b70e90522006d33447dd7e355ae3 (diff) | |
download | luarocks-885f344eec59d0e56aa244b8a490ef7c29f72129.tar.gz luarocks-885f344eec59d0e56aa244b8a490ef7c29f72129.tar.bz2 luarocks-885f344eec59d0e56aa244b8a490ef7c29f72129.zip |
Don't crash when receiving an invalid version number.
(Fixes bug reported by Alexander Gladysh)
-rw-r--r-- | src/luarocks/deps.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index a5af6206..a2cdcf08 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua | |||
@@ -135,7 +135,9 @@ function parse_version(vstring) | |||
135 | -- extract a word | 135 | -- extract a word |
136 | token, rest = vstring:match("^(%a+)[%.%-%_]*(.*)") | 136 | token, rest = vstring:match("^(%a+)[%.%-%_]*(.*)") |
137 | if not token then | 137 | if not token then |
138 | return nil | 138 | print("Warning: version number '"..vstring.."' could not be parsed.") |
139 | version[i] = 0 | ||
140 | break | ||
139 | end | 141 | end |
140 | local last = #version | 142 | local last = #version |
141 | version[i] = deltas[token] or (token:byte() / 1000) | 143 | version[i] = deltas[token] or (token:byte() / 1000) |