forked from loafle/openapi-generator-original
Adds operation null check avoid null exception (#15599)
* Adds operation null check in the method GetOperationServerUrl to avoid null exception * Adds operation null check to avoid null exception to the csharp net core mustache * update C# samples --------- Co-authored-by: William Cheng <wing328hk@gmail.com>
This commit is contained in:
@@ -544,7 +544,7 @@ namespace {{packageName}}.Client
|
||||
/// <return>The operation server URL.</return>
|
||||
public string GetOperationServerUrl(string operation, int index, Dictionary<string, string> inputVariables)
|
||||
{
|
||||
if (OperationServers.TryGetValue(operation, out var operationServer))
|
||||
if (operation != null && OperationServers.TryGetValue(operation, out var operationServer))
|
||||
{
|
||||
return GetServerUrl(operationServer, index, inputVariables);
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ namespace Org.OpenAPITools.Client
|
||||
/// <return>The operation server URL.</return>
|
||||
public string GetOperationServerUrl(string operation, int index, Dictionary<string, string> inputVariables)
|
||||
{
|
||||
if (OperationServers.TryGetValue(operation, out var operationServer))
|
||||
if (operation != null && OperationServers.TryGetValue(operation, out var operationServer))
|
||||
{
|
||||
return GetServerUrl(operationServer, index, inputVariables);
|
||||
}
|
||||
|
||||
@@ -569,7 +569,7 @@ namespace Org.OpenAPITools.Client
|
||||
/// <return>The operation server URL.</return>
|
||||
public string GetOperationServerUrl(string operation, int index, Dictionary<string, string> inputVariables)
|
||||
{
|
||||
if (OperationServers.TryGetValue(operation, out var operationServer))
|
||||
if (operation != null && OperationServers.TryGetValue(operation, out var operationServer))
|
||||
{
|
||||
return GetServerUrl(operationServer, index, inputVariables);
|
||||
}
|
||||
|
||||
@@ -544,7 +544,7 @@ namespace Org.OpenAPITools.Client
|
||||
/// <return>The operation server URL.</return>
|
||||
public string GetOperationServerUrl(string operation, int index, Dictionary<string, string> inputVariables)
|
||||
{
|
||||
if (OperationServers.TryGetValue(operation, out var operationServer))
|
||||
if (operation != null && OperationServers.TryGetValue(operation, out var operationServer))
|
||||
{
|
||||
return GetServerUrl(operationServer, index, inputVariables);
|
||||
}
|
||||
|
||||
@@ -574,7 +574,7 @@ namespace Org.OpenAPITools.Client
|
||||
/// <return>The operation server URL.</return>
|
||||
public string GetOperationServerUrl(string operation, int index, Dictionary<string, string> inputVariables)
|
||||
{
|
||||
if (OperationServers.TryGetValue(operation, out var operationServer))
|
||||
if (operation != null && OperationServers.TryGetValue(operation, out var operationServer))
|
||||
{
|
||||
return GetServerUrl(operationServer, index, inputVariables);
|
||||
}
|
||||
|
||||
@@ -574,7 +574,7 @@ namespace Org.OpenAPITools.Client
|
||||
/// <return>The operation server URL.</return>
|
||||
public string GetOperationServerUrl(string operation, int index, Dictionary<string, string> inputVariables)
|
||||
{
|
||||
if (OperationServers.TryGetValue(operation, out var operationServer))
|
||||
if (operation != null && OperationServers.TryGetValue(operation, out var operationServer))
|
||||
{
|
||||
return GetServerUrl(operationServer, index, inputVariables);
|
||||
}
|
||||
|
||||
@@ -574,7 +574,7 @@ namespace Org.OpenAPITools.Client
|
||||
/// <return>The operation server URL.</return>
|
||||
public string GetOperationServerUrl(string operation, int index, Dictionary<string, string> inputVariables)
|
||||
{
|
||||
if (OperationServers.TryGetValue(operation, out var operationServer))
|
||||
if (operation != null && OperationServers.TryGetValue(operation, out var operationServer))
|
||||
{
|
||||
return GetServerUrl(operationServer, index, inputVariables);
|
||||
}
|
||||
|
||||
@@ -544,7 +544,7 @@ namespace Org.OpenAPITools.Client
|
||||
/// <return>The operation server URL.</return>
|
||||
public string GetOperationServerUrl(string operation, int index, Dictionary<string, string> inputVariables)
|
||||
{
|
||||
if (OperationServers.TryGetValue(operation, out var operationServer))
|
||||
if (operation != null && OperationServers.TryGetValue(operation, out var operationServer))
|
||||
{
|
||||
return GetServerUrl(operationServer, index, inputVariables);
|
||||
}
|
||||
|
||||
@@ -569,7 +569,7 @@ namespace Org.OpenAPITools.Client
|
||||
/// <return>The operation server URL.</return>
|
||||
public string GetOperationServerUrl(string operation, int index, Dictionary<string, string> inputVariables)
|
||||
{
|
||||
if (OperationServers.TryGetValue(operation, out var operationServer))
|
||||
if (operation != null && OperationServers.TryGetValue(operation, out var operationServer))
|
||||
{
|
||||
return GetServerUrl(operationServer, index, inputVariables);
|
||||
}
|
||||
|
||||
@@ -574,7 +574,7 @@ namespace Org.OpenAPITools.Client
|
||||
/// <return>The operation server URL.</return>
|
||||
public string GetOperationServerUrl(string operation, int index, Dictionary<string, string> inputVariables)
|
||||
{
|
||||
if (OperationServers.TryGetValue(operation, out var operationServer))
|
||||
if (operation != null && OperationServers.TryGetValue(operation, out var operationServer))
|
||||
{
|
||||
return GetServerUrl(operationServer, index, inputVariables);
|
||||
}
|
||||
|
||||
@@ -469,7 +469,7 @@ namespace Org.OpenAPITools.Client
|
||||
/// <return>The operation server URL.</return>
|
||||
public string GetOperationServerUrl(string operation, int index, Dictionary<string, string> inputVariables)
|
||||
{
|
||||
if (OperationServers.TryGetValue(operation, out var operationServer))
|
||||
if (operation != null && OperationServers.TryGetValue(operation, out var operationServer))
|
||||
{
|
||||
return GetServerUrl(operationServer, index, inputVariables);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user