Skip to content

Commit eecfa2a

Browse files
committed
move variable-updating etc to after error-checks
1 parent 7fa0218 commit eecfa2a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/PDL/Graphics/TriD/Objects.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ sub new {
182182
my ($type,$points,$faceidx,$colors) = @_;
183183
my $this = $type->SUPER::new($points,$colors,$options);
184184
$faceidx = $this->{Faceidx} = $faceidx->ulong; # (3,nfaces) indices
185-
$options = $this->{Options};
186-
my ($idxflat, $idx0, @idxdims) = ($faceidx->flat, $faceidx->dims);
187185
PDL::barf "Triangles error: broadcast dimensions forbidden for '$_' [@{[$this->{$_}->dims]}]" for grep $this->{$_}->ndims != 2, qw(Points Colors Faceidx);
188186
PDL::barf "Triangles error: dimension mismatch between Points [@{[$this->{Points}->dims]}] and Colors [@{[$this->{Colors}->dims]}]" if $this->{Points}->ndims != $this->{Colors}->ndims or $this->{Points}->dim(1) != $this->{Colors}->dim(1);
187+
$options = $this->{Options};
188+
my ($idxflat, $idx0, @idxdims) = ($faceidx->flat, $faceidx->dims);
189189
if ($options->{Shading} or $options->{ShowNormals}) {
190190
my ($fn, $vn) = triangle_normals($this->{Points}, $faceidx);
191191
if ($options->{ShowNormals}) {

0 commit comments

Comments
 (0)