Fred T-H avatar Fred T-H committed 6159d32

adding them little guards for parameters

Comments (0)

Files changed (1)


     chut_client:message(From, To, Message),
     chut_client:disconnect(From, H),
     %% we clear the event messages because mochiweb re-uses the same procs
-    %% over and over again in a pool. Otherwise, we leak memory and when the
+    %% over and over again in a pool. Otherwise, memory leaks and when the
     %% listen call gets the right message process, a backlog gets printed to
     %% the user.
     io:format("listen call~n"),
     Params = Req:parse_qs(),
     Nick = proplists:get_value("id", Params),
+    ok = check_params(Req, [Nick], ["id"]),
     {ok,Handler} = chut_client:connect(Nick),
     Msgs = chut_client:listen(Nick,Handler),
     JSON = mochijson2:encode([json_prepare(M) || M <- Msgs]),
     io:format("history call~n"),
     Params = Req:parse_qs(),
     Nick = proplists:get_value("id",Params),
+    ok = check_params(Req, [Nick], ["id"]),
     {ok, Handler} = chut_client:connect(Nick),
     Msgs = chut_client:history(Nick),
     JSON = mochijson2:encode([json_prepare(M) || M <- Msgs]),
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.