]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix bug with empty table.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 21 Oct 2011 14:26:39 +0000 (14:26 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 21 Oct 2011 14:26:39 +0000 (14:26 +0000)
git-svn-id: https://svn.dealii.org/trunk@24650 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/source/base/table_handler.cc

index 30dea0c40e205500d24a7ba5bcc0115d24e790f3..77132af44df19779d9ca7014dbdf002c9101947e 100644 (file)
@@ -44,6 +44,11 @@ inconvenience this causes.
 <h3>Specific improvements</h3>
 
 <ol>
+<li> Fixed: Trying to write a TableHandler object that is empty resulted
+in a segmentation fault. This is now fixed.
+<br>
+(Wolfgang Bangerth, 2011/10/21)
+
 <li> New: The TableHandler class can now pad columns that have only been
 partially filled. See the documentation of the class for a description.
 <br>
index a4d8960d0ae5bea1ddf7aed2dfc84d6a274c6d70..2ec8f10ca024aee9ca5e33f088f0181ab8c7308f 100644 (file)
@@ -441,7 +441,10 @@ void TableHandler::write_tex (std::ostream &out, const bool with_header) const
 
 unsigned int TableHandler::n_rows() const
 {
-  std::map<std::string, Column>::const_iterator col_iter=columns.begin();
+  if (columns.size() == 0)
+    return 0;
+  
+  std::map<std::string, Column>::const_iterator col_iter = columns.begin();
   unsigned int n = col_iter->second.entries.size();
   std::string first_name=col_iter->first;
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.