From 9091d4c10224efdb95f052dbb6ed07aef761f4d7 Mon Sep 17 00:00:00 2001
From: Alexander Sulfrian <alexander@sulfrian.net>
Date: Tue, 12 Oct 2010 07:44:33 +0200
Subject: fix exception if no input

---
 calc.erl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/calc.erl b/calc.erl
index b7981a1..04ac38f 100644
--- a/calc.erl
+++ b/calc.erl
@@ -9,6 +9,8 @@ num([Current|Input], Num) when ($0 =< Current) and ($9 >= Current) ->
     num(Input, Num ++ [Current]);
 num([Head|_], "-") ->
     {error, {unexpected, list_to_atom([Head])}};
+num(Input, []) ->
+    {ok, {Input, []}};
 num(Input, Num) ->
     {ok, {Input, list_to_integer(Num)}}.
 
-- 
cgit v1.2.3