Merge pull request #82 from danielyxie/dev

Fixed bug with buying selling 0 shares
This commit is contained in:
danielyxie 2017-07-03 21:39:59 -05:00 committed by GitHub
commit 1069d40d2e

@ -227,6 +227,7 @@ function initSymbolToStockMap() {
//Returns true if successful, false otherwise //Returns true if successful, false otherwise
function buyStock(stock, shares) { function buyStock(stock, shares) {
if (shares == 0) {return false;}
if (stock == null || shares < 0) { if (stock == null || shares < 0) {
dialogBoxCreate("Failed to buy stock. This may be a bug, contact developer"); dialogBoxCreate("Failed to buy stock. This may be a bug, contact developer");
return false; return false;
@ -255,6 +256,7 @@ function buyStock(stock, shares) {
//Returns true if successful and false otherwise //Returns true if successful and false otherwise
function sellStock(stock, shares) { function sellStock(stock, shares) {
if (shares == 0) {return false;}
if (stock == null || shares < 0) { if (stock == null || shares < 0) {
dialogBoxCreate("Failed to sell stock. This may be a bug, contact developer"); dialogBoxCreate("Failed to sell stock. This may be a bug, contact developer");
return false; return false;