diff --git a/src/gui/input.C b/src/gui/input.C index 307348c..e4fb8e0 100644 --- a/src/gui/input.C +++ b/src/gui/input.C @@ -195,9 +195,14 @@ canvas_input_callback ( O_Canvas *widget, Canvas *c, int m ) break; case 'c': { - c->grid( c->grid()->create() ); + Grid *g = c->grid()->create(); - ui->update_sequence_widgets(); + if ( g ) + { + c->grid( g ); + + ui->update_sequence_widgets(); + } break; } diff --git a/src/pattern.C b/src/pattern.C index a4e88ce..e25c041 100644 --- a/src/pattern.C +++ b/src/pattern.C @@ -261,7 +261,12 @@ pattern::recording ( void ) pattern * pattern::create ( void ) { - return new pattern; + if ( pattern::patterns() < 128 ) + { + return new pattern; + } + else + return NULL; } pattern * diff --git a/src/phrase.C b/src/phrase.C index a38811a..964828f 100644 --- a/src/phrase.C +++ b/src/phrase.C @@ -109,7 +109,12 @@ phrase::reset ( void ) phrase * phrase::create ( void ) { - return new phrase; + if ( phrase::phrases() < 128 ) + { + return new phrase; + } + else + return NULL; } phrase *