Skip to content

Commit 6e16cbc

Browse files
committed
fix null reference exception
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
1 parent 471a61a commit 6e16cbc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Microsoft.OpenApi/Services/OpenApiVisitorBase.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ public abstract class OpenApiVisitorBase
2828
/// <param name="segment">Identifier for context</param>
2929
public virtual void Enter(string segment)
3030
{
31+
if (string.IsNullOrEmpty(segment))
32+
{
33+
this._path.Push(string.Empty);
34+
return;
35+
}
3136
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP1_0_OR_GREATER
3237
this._path.Push(segment.Replace("~", "~0", StringComparison.Ordinal).Replace("/", "~1", StringComparison.OrdinalIgnoreCase));
3338
#else

0 commit comments

Comments
 (0)