diff --git a/ExprPrimaryNodes.py b/ExprPrimaryNodes.py
index 033c66c78601bc7138e1c08736afe9deb9ff9768..71674cbc41f82d25b1545c838bfd2428db4bc269 100644
--- a/ExprPrimaryNodes.py
+++ b/ExprPrimaryNodes.py
@@ -619,7 +619,7 @@ class ExprNode(ASTNode):
                     leftArg = ArgsNode(self.parseTree, self.typeName, [self.left])
                     # 3. Put it all together
                     concatLeft = MethodInvNode(self.parseTree, self.typeName, valueOfNameNode, leftArg)
-                
+
                 if self.right.myType.name != 'java.lang.String':
                     # 2. Make ArgsNode
                     rightArg = ArgsNode(self.parseTree, self.typeName, [self.right])
@@ -773,7 +773,7 @@ class ExprNode(ASTNode):
             return
 
         # Binary operations:
-        
+
         # Number Add, Subtract, Multiply
         if self.op in ['+', '-', '*']:
             # operation -> generated code
@@ -791,6 +791,11 @@ class ExprNode(ASTNode):
             # switch eax and ebx, because "idiv ebx" -> eax = edx:eax / ebx
             self.code += p('xchg', 'eax', 'ebx')
 
+            # divide by 0 check
+            if self.op == '/':
+                self.code += p("cmp", "ebx", "0")
+                self.code += p("je", "H__Throw_Exception")
+
             self.code += p('push', 'edx') # save edx in case someone else was using it
             self.code += p('cdq', '', None, " set edx to the sign of eax")
             self.code += p("idiv", "ebx", "", " left:eax " + self.op + " right:ebx")