gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/window.cpp
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2012年05月11日 12:51:53 +0200
committerFrancesco Abbate <francesco.bbt@gmail.com>2012年05月11日 12:51:53 +0200
commitb857a562839b3b35b8c74aa52d0ad8a20f7d8d19 (patch)
treef5044e8216b982e6fcda8e64ca84db14ac0c1ad5 /agg-plot/window.cpp
parent696ddad48760350ebba16562c749aca3f93659fd (diff)
downloadgsl-shell-b857a562839b3b35b8c74aa52d0ad8a20f7d8d19.tar.gz
Report error for incorrect window's split specifications
Diffstat (limited to 'agg-plot/window.cpp')
-rw-r--r--agg-plot/window.cpp 26
1 files changed, 13 insertions, 13 deletions
diff --git a/agg-plot/window.cpp b/agg-plot/window.cpp
index 6880c79a..52c606ec 100644
--- a/agg-plot/window.cpp
+++ b/agg-plot/window.cpp
@@ -289,20 +289,17 @@ bool
window::split(const char *spec)
{
::split<ref>::lexer lexbuf(spec);
- tree::node<ref, direction_e> *new_tree = ::split<ref>::parse(lexbuf);
+ tree::node<ref, direction_e> *parse_tree = ::split<ref>::parse(lexbuf);
+ delete m_tree;
- if (new_tree)
- {
- if (m_tree)
- delete m_tree;
-
- m_tree = new_tree;
- bmatrix m0;
- ref::calculate(m_tree, m0, 0);
- return true;
- }
+ if (parse_tree)
+ m_tree = parse_tree;
+ else
+ m_tree = new tree::leaf<ref, direction_e>();
- return false;
+ bmatrix m0;
+ ref::calculate(m_tree, m0, 0);
+ return (parse_tree != NULL);
}
static const char *
@@ -433,7 +430,10 @@ window_new (lua_State *L)
return luaL_error (L, "%s (reported during %s)", st.error_msg(), st.context());
if (spec)
- win->split(spec);
+ {
+ if (!win->split(spec))
+ return luaL_error(L, "invalid layout specification");
+ }
return 1;
}
generated by cgit v1.2.3 (git 2.25.1) at 2025年09月17日 05:01:28 +0000

AltStyle によって変換されたページ (->オリジナル) /