We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 99a382b commit 9516894Copy full SHA for 9516894
ColorSetKit/ColorSetStream.m
@@ -150,11 +150,18 @@ - ( nullable NSString * )readString
150
151
@synchronized( self )
152
{
153
- if( [ self read: 8 in: &n ] && n > 1 )
+ if( [ self read: 8 in: &n ] && n > 0 )
154
155
- if( ( data = [ self readDataOfLength: n - 1 ] ) )
+ if( ( data = [ self readDataOfLength: n ] ) )
156
157
- return [ [ NSString alloc ] initWithData: data encoding: NSASCIIStringEncoding ];
+ if( data.length > 1 )
158
+ {
159
+ return [ [ NSString alloc ] initWithData: [ data subdataWithRange: NSMakeRange( 0, data.length - 1 ) ] encoding: NSASCIIStringEncoding ];
160
+ }
161
+ else
162
163
+ return @"";
164
165
}
166
167
0 commit comments