diff libinterp/corefcn/oct-hist.cc @ 20617:ba2b07c13913

use new string_value method to handle value extraction errors * __dispatch__.cc, balance.cc, colloc.cc, conv2.cc, data.cc, debug.cc, graphics.cc, input.cc, matrix_type.cc, oct-hist.cc, schur.cc, spparms.cc, symtab.cc, sysdep.cc, toplev.cc, utils.cc: Use new string_value method.
author John W. Eaton <jwe@octave.org>
date Fri, 09 Oct 2015 10:06:39 -0400
parents a9574e3c6e9e
children
line wrap: on
line diff
--- a/libinterp/corefcn/oct-hist.cc	Thu Oct 08 19:00:51 2015 -0400
+++ b/libinterp/corefcn/oct-hist.cc	Fri Oct 09 10:06:39 2015 -0400
@@ -171,14 +171,11 @@
         {
           if (i < nargin - 1)
             {
-              if (args(i+1).is_string ())
-                command_history::set_file (args(++i).string_value ());
-              else
-                {
-                  error ("history: expecting file name for %s option",
-                         option.c_str ());
-                  return hlist;
-                }
+              std::string fname
+                = args(++i).string_value ("history: expecting file name for %s option",
+                                          option.c_str ());
+
+              command_history::set_file (fname);
             }
           else
             command_history::set_file (default_history_file ());