Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53440 - trunk/libs/program_options/src
From: ghost_at_[hidden]
Date: 2009-05-30 06:26:45


Author: vladimir_prus
Date: 2009-05-30 06:26:44 EDT (Sat, 30 May 2009)
New Revision: 53440
URL: http://svn.boost.org/trac/boost/changeset/53440

Log:
Make 'notify' ignore values without associated semantics.

Fixes #2782.

Text files modified:
   trunk/libs/program_options/src/variables_map.cpp | 11 ++++++++++-
   1 files changed, 10 insertions(+), 1 deletions(-)

Modified: trunk/libs/program_options/src/variables_map.cpp
==============================================================================
--- trunk/libs/program_options/src/variables_map.cpp (original)
+++ trunk/libs/program_options/src/variables_map.cpp 2009-05-30 06:26:44 EDT (Sat, 30 May 2009)
@@ -133,7 +133,16 @@
              k != vm.end();
              ++k)
         {
- k->second.m_value_semantic->notify(k->second.value());
+ /* Users might wish to use variables_map to store their own values
+ that are not parsed, and therefore will not have value_semantics
+ defined. Do no crash on such values. In multi-module programs,
+ one module might add custom values, and the 'notify' function
+ will be called after that, so we check that value_sematics is
+ not NULL. See:
+ https://svn.boost.org/trac/boost/ticket/2782
+ */
+ if (k->second.m_value_semantic)
+ k->second.m_value_semantic->notify(k->second.value());
         }
     }
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk