Skip to content

Commit

Permalink
Added null-ptr check in Colour::use()
Browse files Browse the repository at this point in the history
  • Loading branch information
geh authored and horenmar committed Jun 15, 2019
1 parent f41051f commit bbbd5c4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/internal/catch_console_colour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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& ) {
Expand Down

0 comments on commit bbbd5c4

Please sign in to comment.