diff --git a/lib/randiso.gi b/lib/randiso.gi index f044b0fd7d..5526ab3abd 100644 --- a/lib/randiso.gi +++ b/lib/randiso.gi @@ -240,6 +240,9 @@ InstallGlobalFunction( CodePcgs, function( pcgs ) # basic structures l := Length( pcgs ); + if l = 0 then + return 0; + fi; indices := RelativeOrders( pcgs ); mi := Maximum( indices ) - 1; code := 0; diff --git a/tst/testbugfix/2017-09-06-CodePcGroup.tst b/tst/testbugfix/2017-09-06-CodePcGroup.tst new file mode 100644 index 0000000000..8055525437 --- /dev/null +++ b/tst/testbugfix/2017-09-06-CodePcGroup.tst @@ -0,0 +1,7 @@ +# Issue #1664 on github.com/gap-system/gap +gap> G := TrivialGroup(IsPcGroup); + +gap> CodePcGroup(G); +0 +gap> IsTrivial(PcGroupCode(0, 1)); +true