From: bangerth Date: Fri, 21 Oct 2011 14:26:39 +0000 (+0000) Subject: Fix bug with empty table. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe7b7bbde07d0f7da014289bb7a3e98c3be1d6b6;p=dealii-svn.git Fix bug with empty table. git-svn-id: https://svn.dealii.org/trunk@24650 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 30dea0c40e..77132af44d 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -44,6 +44,11 @@ inconvenience this causes.

Specific improvements

    +
  1. Fixed: Trying to write a TableHandler object that is empty resulted +in a segmentation fault. This is now fixed. +
    +(Wolfgang Bangerth, 2011/10/21) +
  2. New: The TableHandler class can now pad columns that have only been partially filled. See the documentation of the class for a description.
    diff --git a/deal.II/source/base/table_handler.cc b/deal.II/source/base/table_handler.cc index a4d8960d0a..2ec8f10ca0 100644 --- a/deal.II/source/base/table_handler.cc +++ b/deal.II/source/base/table_handler.cc @@ -441,7 +441,10 @@ void TableHandler::write_tex (std::ostream &out, const bool with_header) const unsigned int TableHandler::n_rows() const { - std::map::const_iterator col_iter=columns.begin(); + if (columns.size() == 0) + return 0; + + std::map::const_iterator col_iter = columns.begin(); unsigned int n = col_iter->second.entries.size(); std::string first_name=col_iter->first;