Skip to content

Commit

Permalink
Added defensive code in set_account for when user isnt approved yet (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
swimclan authored and aurbano committed Nov 2, 2017
1 parent 3a9f94a commit e3279e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "robinhood",
"version": "1.1.1",
"version": "1.1.2",
"description": "Comprehensive NodeJS API wrapper for the Robinhood API",
"main": "src/robinhood.js",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions src/robinhood.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Robinhood API NodeJS Wrapper
* @author Alejandro U. Alvarez
* @license AGPLv3 - See LICENSE file for more details
* @version 1.1.1
* @version 1.1.2
*/

'use strict';
Expand Down Expand Up @@ -143,8 +143,8 @@ function RobinhoodWebApi(opts, callback) {
if (err) {
reject(err);
}

if (body.results) {
// Being defensive when user credentials are valid but RH has not approved an account yet
if (body.results && body.results instanceof Array && body.results.length > 0) {
_private.account = body.results[0].url;
}
resolve();
Expand Down

0 comments on commit e3279e3

Please sign in to comment.