diff options
| author | Phil Nash | 2012-07-28 20:37:07 +0100 |
|---|---|---|
| committer | Phil Nash | 2012-07-28 20:37:07 +0100 |
| commit | 61756974d0246b2bba4b030d96e1d4d46982be04 (patch) | |
| tree | ef69e193f3d5c1526c031623ef27357b3f88c566 /include | |
| parent | b084562b3bd213da3cd9e422a2343073d8e34d11 (diff) | |
| download | catch3-61756974d0246b2bba4b030d96e1d4d46982be04.tar.gz | |
Catches incorrect reporter name as per #107
Diffstat (limited to 'include')
| -rw-r--r-- | include/catch_runner.hpp | 6 | ||||
| -rw-r--r-- | include/internal/catch_ptr.hpp | 9 |
2 files changed, 13 insertions, 2 deletions
diff --git a/include/catch_runner.hpp b/include/catch_runner.hpp index 752a6b84..7b0eda70 100644 --- a/include/catch_runner.hpp +++ b/include/catch_runner.hpp @@ -36,6 +36,12 @@ namespace Catch { Ptr<IReporter> reporter = getCurrentContext().getReporterRegistry().create( reporterName, reporterConfig ); + if( !reporter ) + { + std::cerr << "No reporter registered with name: " << reporterName << "'" << std::endl; + return (std::numeric_limits<int>::max)(); + } + if( !config.data().stream.empty() ) { if( config.data().stream[0] == '%' ) config.useStream( config.data().stream.substr( 1 ) ); diff --git a/include/internal/catch_ptr.hpp b/include/internal/catch_ptr.hpp index 3ebe9f74..73e53ac9 100644 --- a/include/internal/catch_ptr.hpp +++ b/include/internal/catch_ptr.hpp @@ -20,10 +20,12 @@ namespace Catch { public: Ptr() : m_p( NULL ){} Ptr( T* p ) : m_p( p ){ - m_p->addRef(); + if( m_p ) + m_p->addRef(); } Ptr( const Ptr& other ) : m_p( other.m_p ){ - m_p->addRef(); + if( m_p ) + m_p->addRef(); } ~Ptr(){ if( m_p ) @@ -63,6 +65,9 @@ namespace Catch { const T* operator->() const{ return m_p; } + bool operator !() const { + return m_p == NULL; + } private: T* m_p; |