changeset 18961:5e99fd6ea758 stable

graphics.cc: fix segfault in __calc_dimensions__ when args is empty
author Andreas Weber <andy.weber.aw@gmail.com>
date Wed, 21 May 2014 18:21:05 +0200
parents a6d13c62fccf
children 4293f49795d9
files libinterp/corefcn/graphics.cc
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc
+++ b/libinterp/corefcn/graphics.cc
@@ -9226,16 +9226,17 @@
 
   int nargin = args.length ();
 
-  if (nargin != 1)
+  if (nargin == 1)
+    {
+      double h = args(0).double_value ();
+      if (! error_state)
+        retval = calc_dimensions (gh_manager::get_object (h));
+      else
+        error ("__calc_dimensions__: expecting graphics handle as only argument");
+    }
+  else
     print_usage ();
 
-  double h = args(0).double_value ();
-
-  if (! error_state)
-    retval = calc_dimensions (gh_manager::get_object (h));
-  else
-    error ("__calc_dimensions__: expecting graphics handle as only argument");
-
   return retval;
 }