author | Francesco Abbate <francesco.bbt@gmail.com> | 2012年05月11日 12:51:53 +0200 |
---|---|---|
committer | Francesco Abbate <francesco.bbt@gmail.com> | 2012年05月11日 12:51:53 +0200 |
commit | b857a562839b3b35b8c74aa52d0ad8a20f7d8d19 (patch) | |
tree | f5044e8216b982e6fcda8e64ca84db14ac0c1ad5 /agg-plot/window.cpp | |
parent | 696ddad48760350ebba16562c749aca3f93659fd (diff) | |
download | gsl-shell-b857a562839b3b35b8c74aa52d0ad8a20f7d8d19.tar.gz |
-rw-r--r-- | agg-plot/window.cpp | 26 |
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; } |