Mercurial > octave
changeset 30890:ac478fdded94
Ffdisp: Place validation/error code before normal code.
* pr-output.cc (Ffdisp): re-arrange code to test for valid stream before
continuing with rest of function.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 04 Apr 2022 11:11:01 -0700 |
parents | 3a15bf04cb7f |
children | 79b3c0b5c265 |
files | libinterp/corefcn/pr-output.cc |
diffstat | 1 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/pr-output.cc Mon Apr 04 10:50:26 2022 -0700 +++ b/libinterp/corefcn/pr-output.cc Mon Apr 04 11:11:01 2022 -0700 @@ -3399,12 +3399,11 @@ std::ostream *osp = os.output_stream (); + if (! osp) + error ("fdisp: stream FID not open for writing"); + octave_value arg = args(1); - - if (osp) - arg.print (*osp); - else - error ("fdisp: stream FID not open for writing"); + arg.print (*osp); return ovl (); }