From 532dbda651e92d6485e000f6cd1ef40ae7593b93 Mon Sep 17 00:00:00 2001
From: Marvellanius <dickv.viegen@gmail.com>
Date: Wed, 4 May 2016 15:36:54 +0200
Subject: [PATCH] fix empty product bug

---
 app/views/play/modal/BuyGemsModal.coffee | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/views/play/modal/BuyGemsModal.coffee b/app/views/play/modal/BuyGemsModal.coffee
index 0f153a7f9..3ec531ee1 100644
--- a/app/views/play/modal/BuyGemsModal.coffee
+++ b/app/views/play/modal/BuyGemsModal.coffee
@@ -68,6 +68,9 @@ module.exports = class BuyGemsModal extends ModalView
   onClickProductButton: (e) ->
     @playSound 'menu-button-click'
     productID = $(e.target).closest('button').val()
+    # Don't throw error when product is not found
+    if productID.length == 0
+      return
     product = @products.findWhere { name: productID }
 
     if application.isIPadApp