Fixed bug with buying selling 0 shares

This commit is contained in:
Daniel Xie 2017-07-03 21:39:15 -05:00
parent ba353c5d1f
commit 1befaccf3f

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