Commit 73875552 authored by Matthew Taylor's avatar Matthew Taylor

Merge pull request #330 from mewtaylor/issue/gh-322-typeerror

Fix GH-322: surround redirect check in try/catch
parents 2e79a5aa 41c23f76
......@@ -44,7 +44,11 @@ var Api = {
if (err) log.error(err);
// Legacy API responses come as lists, and indicate to redirect the client like
// [{success: true, redirect: "/location/to/redirect"}]
if (body && body[0] && 'redirect' in body[0]) window.location = body[0].redirect;
try {
if ('redirect' in body[0]) window.location = body[0].redirect;
} catch (err) {
// do nothing
}
callback(err, body);
});
}.bind(this);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment