From 8c618fdda44e8ed4377476b58ec10fd2f73869ec Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 24 Aug 2015 01:33:55 +0000 Subject: Minor stability/speed improvements, don't try to write null strings to a stream. --- src/stable/formatter.cpp | 2 ++ src/stable/stream.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/stable/formatter.cpp b/src/stable/formatter.cpp index a757921..f8da5a1 100644 --- a/src/stable/formatter.cpp +++ b/src/stable/formatter.cpp @@ -80,6 +80,8 @@ void Bu::Formatter::write( const void *sStr, int iLen ) void Bu::Formatter::writeAligned( const Bu::String &sStr ) { int iLen = sStr.getSize(); + if( iLen == 0 ) + return; if( iLen > fLast.uMinWidth ) { write( sStr ); diff --git a/src/stable/stream.cpp b/src/stable/stream.cpp index 2ae03d4..1b3555d 100644 --- a/src/stable/stream.cpp +++ b/src/stable/stream.cpp @@ -48,6 +48,8 @@ Bu::String Bu::Stream::readAll() Bu::size Bu::Stream::write( const Bu::String &sBuf ) { - return write( sBuf.getStr(), sBuf.getSize() ); + if( sBuf.getSize() > 0 ) + return write( sBuf.getStr(), sBuf.getSize() ); + return 0; } -- cgit v1.2.3