aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-10-21 16:53:40 +0200
committerThomas White <taw@physics.org>2015-01-29 13:23:38 +0100
commit2a8b5489b7ba7dd8c61315b9e6bb1f7d8820b3c4 (patch)
treec1d9fec17ab20cd66efc6aa3b2edbad92d1f73a1
parent8f1df1c9488cb51e09f5caf736c7b9dae07eb3e5 (diff)
Add an assert()
-rw-r--r--src/whirligig.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/whirligig.c b/src/whirligig.c
index c277cdea..86687f1f 100644
--- a/src/whirligig.c
+++ b/src/whirligig.c
@@ -331,8 +331,14 @@ static IntegerMatrix *try_all(struct window *win, int n1, int n2,
{
int i, j;
IntegerMatrix *m;
- struct image *i1 = &win->img[n1];
- struct image *i2 = &win->img[n2];
+ struct image *i1;
+ struct image *i2;
+
+ assert(n1 >= 0);
+ assert(n2 >= 0);
+
+ i1 = &win->img[n1];
+ i2 = &win->img[n2];
for ( i=0; i<i1->n_crystals; i++ ) {
for ( j=0; j<i2->n_crystals; j++ ) {