diff --git a/gap/bytable.gi b/gap/bytable.gi index 0e1b438..976424e 100644 --- a/gap/bytable.gi +++ b/gap/bytable.gi @@ -406,15 +406,16 @@ InstallOtherMethod(DirectProductOp, "for a list and non-quasigroup magma built form multiplication table", [IsList, IsMagma and IsBuiltFromMultiplicationTable], function (list, first) - local item, i, jof, bigtable; + local n, item, i, jof, bigtable; + n := Length(list); # Simple checks - if IsEmpty(list) then + if n = 0 then Error("Usage: Cannot take DirectProduct of zero items."); - elif Length(list) = 1 then + elif n = 1 then return list[1]; fi; # See if we can handle all objects - for i in [2..Length(list)] do + for i in [2..n] do if not HasMultiplicationTable(list(i)) then return DirectProductOp(Permuted(list, (1,i)), list[i]); fi;