C++ for iphone crash
<p>Im developing a game engine for iphone in C++ but im getting a crash with my Matrix class. I hope you can see whats wrong because i stare my self blind on the crash.</p>

<pre><code>/*
 * Copyright (c) 2010 Johnny Mast
 * 
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:

 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */

#include "Matrix.h"

Matrix::Matrix() {
 /*
 ** if this constuctor has been used you should call
 ** setWidth and setHeight before using this class.
 ** use of this constructor is not reconmended and it 
 ** will producse rended code.
 */
 matrixwidth  = 0;
 matrixheight = 0;
}

Matrix::Matrix(int width, int height) {
 matrixwidth  = width;
 matrixheight = height;
 setupMatrix();
}

void Matrix::setWidth(int width) {
 matrixwidth = width;
 setupMatrix();
}

void Matrix::setHeight(int height) {
 matrixheight = height;
 setupMatrix();
}

void Matrix::mark(int x, int y, int value) {
 NSLog(@"Marking");
 //matrix[x][y] = value;
 NSLog(@"Marked");
}

int Matrix::get(int x, int y) {
 return matrix[x][y]; 
}

#pragma mark -
#pragma mark Private functions from here.

void Matrix::setupMatrix() {
 if (matrixwidth &gt; 0 &amp;&amp; matrixheight &gt; 0) {
  for (int w = 0, h = 0; w &lt; matrixwidth, h &lt; matrixheight; w++, h++) {
   matrix[w][h] = 0;
  } 
 }
}
</code></pre>

<p>The crash is in setupMatrix().</p>
