summaryrefslogtreecommitdiff
path: root/src/index.erl
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2016-11-02 01:30:22 +0100
committerMagnus Ahltorp <map@kth.se>2016-11-02 01:30:22 +0100
commit840228a10b84b7587cc40d1eb2a17d8586187f35 (patch)
tree47861093048eda5f0f8d93e2fa8d45e3590cafc6 /src/index.erl
parente51588399d15cde7ee283e1f72f99ddefa60f83d (diff)
Don't crash in index.erl when index is invalid
Diffstat (limited to 'src/index.erl')
-rw-r--r--src/index.erl11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/index.erl b/src/index.erl
index fe47f59..5fe1dd6 100644
--- a/src/index.erl
+++ b/src/index.erl
@@ -95,8 +95,7 @@ add_internal(File, Index, Entry) when is_binary(Entry), size(Entry) == ?ENTRYSIZ
Index * ?ENTRYSIZEINFILE < Position ->
read;
_ ->
- util:exit_with_error(invalid, writefile,
- "Index not valid")
+ {error, invalidindex}
end,
EntryText = hex:bin_to_hexstr(Entry) ++ "\n",
case Mode of
@@ -112,10 +111,10 @@ add_internal(File, Index, Entry) when is_binary(Entry), size(Entry) == ?ENTRYSIZ
EntryText ->
ok;
_ ->
- util:exit_with_error(invalid, writefile,
- "Written content not the" ++
- " same as old content")
- end
+ {error, invalidcontent}
+ end;
+ {error, Error} ->
+ {error, Error}
end.