# HG changeset patch # User Jaroslav Hajek # Date 1218317583 -7200 # Node ID f0fbf47c914c61d63b45bda33339ffdf7b3c7b0b # Parent fd13f9f7dbacea02095b654dcf83e48735739a2c avoid null pointer call in Array::hermitian diff --git a/liboctave/Array.cc b/liboctave/Array.cc --- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -1262,11 +1262,21 @@ } template +static T +no_op_fcn (const T& x) +{ + return x; +} + +template Array Array::hermitian (T (*fcn) (const T&)) const { assert (ndims () == 2); + if (! fcn) + fcn = no_op_fcn; + octave_idx_type nr = dim1 (); octave_idx_type nc = dim2 (); diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2008-08-11 Jaroslav Hajek + + * Array.cc (no_op_fcn): New static function. + (Array::hermitian): If fcn is null, set to no_op_fcn. + 2008-08-07 John W. Eaton * sprse-base-chol.h, oct-sparse.h: Don't include config.h.