Add nullptr checks to char type logging
This commit is contained in:
@@ -9,12 +9,22 @@ namespace Inferno {
|
|||||||
|
|
||||||
const LogStream& operator<<(const LogStream& stream, const char* value)
|
const LogStream& operator<<(const LogStream& stream, const char* value)
|
||||||
{
|
{
|
||||||
|
if (value == nullptr) {
|
||||||
|
stream.write("(null)", 6);
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
stream.write(value, strlen(value));
|
stream.write(value, strlen(value));
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
const LogStream& operator<<(const LogStream& stream, const unsigned char* value)
|
const LogStream& operator<<(const LogStream& stream, const unsigned char* value)
|
||||||
{
|
{
|
||||||
|
if (value == nullptr) {
|
||||||
|
stream.write("(null)", 6);
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
stream.write(value, strlen((const char*)value));
|
stream.write(value, strlen((const char*)value));
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user