Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include/internal
diff options
context:
space:
mode:
authorgeh2019-05-14 14:14:39 +0200
committerMartin Hořeňovský2019-06-15 18:06:59 +0200
commitbbbd5c4e08e0889389179f61fa27210cd77fbbd3 (patch)
treea12de3a4641cf98bf707b939b2a5f076af963066 /include/internal
parentf41051f22a2e35ef3b60139f0049f7e608f9bb28 (diff)
downloadcatch3-bbbd5c4e08e0889389179f61fa27210cd77fbbd3.tar.gz
Added null-ptr check in Colour::use()
Diffstat (limited to 'include/internal')
-rw-r--r--include/internal/catch_console_colour.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/internal/catch_console_colour.cpp b/include/internal/catch_console_colour.cpp
index 0a13a1bb..1c4799f8 100644
--- a/include/internal/catch_console_colour.cpp
+++ b/include/internal/catch_console_colour.cpp
@@ -222,7 +222,13 @@ namespace Catch {
void Colour::use( Code _colourCode ) {
static IColourImpl* impl = platformColourInstance();
- impl->use( _colourCode );
+ // Strictly speaking, this cannot possibly happen.
+ // However, under some conditions it does happen (see #1626),
+ // and this change is small enough that we can let practicality
+ // triumph over purity in this case.
+ if (impl != NULL) {
+ impl->use( _colourCode );
+ }
}
std::ostream& operator << ( std::ostream& os, Colour const& ) {