diff --git a/R3.xs b/R3.xs index bc4e801..68fc90a 100644 --- a/R3.xs +++ b/R3.xs @@ -2895,6 +2895,7 @@ match(SV* r3_sv, SV *str_sv) void DESTROY(SV* r3_sv) PPCODE: void* pad = SvRV(SvRV(r3_sv)); + if (!pad) return; int branch_n = *(int*)((char*)pad + sizeof(node*)); SV** target = (SV**)((char*)pad + sizeof(node*) + sizeof(int)); for(int i=0; i 1' to 'tests => last_test_to_print'; + +use strict; +use warnings; + +use Test::More tests => 2; +BEGIN { use_ok('Router::R3') }; + +my %router; + +sub _init { + %router = ( + POST => Router::R3->new( + '/api/v1/event/create' => sub {}, + '/api/v1/account/i/{i_account:\d+}/status' => sub {}, + ), + GET => Router::R3->new( + '/api/v1/account/i/{i_account:\d+}/status' => sub {}, + '/api/v1/account/{id}/status' => sub {}, + ), + DELETE => Router::R3->new( + '/api/v1/group/i/{i_group:\d+}' => sub {}, + '/api/v1/group/{name}' => sub {}, + ), + ); +} + +_init(); + +ok( $router{POST}->match( '/api/v1/event/create' ) ); +# ensure that there are no Segmentation Fault on exit