diff --git a/NIF_Blocks.cpp b/NIF_Blocks.cpp
index 5c07d6ae4e2e984620ab07d25c4b688cd637b702..e22c68a1f234b3f101b1b1296d491add40a33123 100644
--- a/NIF_Blocks.cpp
+++ b/NIF_Blocks.cpp
@@ -4466,7 +4466,7 @@ string NiStringPalette::asString() const {
 	out << "String Palette:" << endl
 		<< "   0:  ";
 
-	for ( uint i = 0; i < pal.size() - 1; ++i ) {
+	if ( pal.size() > 0 ) for ( uint i = 0; i < pal.size() - 1; ++i ) {
 		if ( pal[i] == '\0') {
 			out << endl << "   " << i + 1 << ":  ";
 		} else {
diff --git a/NIF_IO.cpp b/NIF_IO.cpp
index 325804618e78cc6449c5ca989300245131124b29..1ec9fcbe936e018f8332946b20e48dc01c5f668c 100644
--- a/NIF_IO.cpp
+++ b/NIF_IO.cpp
@@ -231,8 +231,10 @@ void ReadFVector4( fVector4& fvec, istream& in ){
 string ReadString( istream &in ) {
 	uint len = ReadUInt( in );
 	string out;
-	out.resize( len );
-	in.read( (char*)&out[0], len );
+	if ( len > 0 ) {
+		out.resize( len );
+		in.read( (char*)&out[0], len );
+	}
 	return out;
 }