File tree 2 files changed +11
-3
lines changed
NetworkingManagerComponents/Binary
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -216,9 +216,9 @@ public string GetChannel()
216
216
public class NetworkedVarString : NetworkedVar < string >
217
217
{
218
218
/// <inheritdoc />
219
- public NetworkedVarString ( ) { }
219
+ public NetworkedVarString ( ) : base ( string . Empty ) { }
220
220
/// <inheritdoc />
221
- public NetworkedVarString ( NetworkedVarSettings settings ) : base ( settings ) { }
221
+ public NetworkedVarString ( NetworkedVarSettings settings ) : base ( settings , string . Empty ) { }
222
222
/// <inheritdoc />
223
223
public NetworkedVarString ( string value ) : base ( value ) { }
224
224
/// <inheritdoc />
Original file line number Diff line number Diff line change @@ -97,6 +97,10 @@ public void WriteObjectPacked(object value)
97
97
}
98
98
else if ( value is string )
99
99
{
100
+ if ( value == null )
101
+ {
102
+ throw new ArgumentException ( "BitWriter cannot write strings with a null value" ) ;
103
+ }
100
104
WriteStringPacked ( ( string ) value ) ;
101
105
return ;
102
106
}
@@ -186,8 +190,12 @@ public void WriteObjectPacked(object value)
186
190
WriteUInt16Packed ( ( ( NetworkedBehaviour ) value ) . GetBehaviourId ( ) ) ;
187
191
return ;
188
192
}
189
- else if ( value is IBitWritable )
193
+ else if ( value is IBitWritable )
190
194
{
195
+ if ( value == null )
196
+ {
197
+ throw new ArgumentException ( "BitWriter cannot write IBitWritable types with a null value" ) ;
198
+ }
191
199
( ( IBitWritable ) value ) . Write ( this . sink ) ;
192
200
return ;
193
201
}
You can’t perform that action at this time.
0 commit comments