@@ -344,33 +344,33 @@ private static void SerializeBounds(IOpenApiWriter writer, OpenApiSpecVersion ve
344344 writer . WritePropertyName ( exclusivePropertyName ) ;
345345 writer . WriteRaw ( exclusiveValue ) ;
346346 }
347- else if ( isExclusiveValue == true && ! string . IsNullOrEmpty ( value ) )
347+ else if ( isExclusiveValue == true && ! string . IsNullOrEmpty ( value ) && value is not null )
348348 {
349349 // came from parsing an old document
350350 writer . WritePropertyName ( exclusivePropertyName ) ;
351- writer . WriteRaw ( value ! ) ;
351+ writer . WriteRaw ( value ) ;
352352 }
353- else if ( ! string . IsNullOrEmpty ( value ) )
353+ else if ( ! string . IsNullOrEmpty ( value ) && value is not null )
354354 {
355355 // was explicitly set in the document or object model
356356 writer . WritePropertyName ( propertyName ) ;
357- writer . WriteRaw ( value ! ) ;
357+ writer . WriteRaw ( value ) ;
358358 }
359359 }
360360 else
361361 {
362- if ( ! string . IsNullOrEmpty ( exclusiveValue ) )
362+ if ( ! string . IsNullOrEmpty ( exclusiveValue ) && exclusiveValue is not null )
363363 {
364364 // was explicitly set in a new document being downcast or object model
365365 writer . WritePropertyName ( propertyName ) ;
366- writer . WriteRaw ( exclusiveValue ! ) ;
366+ writer . WriteRaw ( exclusiveValue ) ;
367367 writer . WriteProperty ( isExclusivePropertyName , true ) ;
368368 }
369- else if ( ! string . IsNullOrEmpty ( value ) )
369+ else if ( ! string . IsNullOrEmpty ( value ) && value is not null )
370370 {
371371 // came from parsing an old document, we're just mirroring the information
372372 writer . WritePropertyName ( propertyName ) ;
373- writer . WriteRaw ( value ! ) ;
373+ writer . WriteRaw ( value ) ;
374374 if ( isExclusiveValue . HasValue )
375375 writer . WriteProperty ( isExclusivePropertyName , isExclusiveValue . Value ) ;
376376 }
0 commit comments