Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit d0a86b9

Browse files
committed
handle null ref ex for creator apis sans operation policies
1 parent 9f294ce commit d0a86b9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/APIM_ARMTemplate/apimtemplate/Creator/TemplateCreators/MasterTemplateCreator.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,16 @@ public bool DetermineIfAPIDependsOnLogger(APIConfig api, FileReader fileReader)
174174
// capture api policy dependent on logger
175175
return true;
176176
}
177-
foreach (KeyValuePair<string, OperationsConfig> operation in api.operations)
177+
if (api.operations != null)
178178
{
179-
string operationPolicy = operation.Value.policy != null ? fileReader.RetrieveLocalFileContents(operation.Value.policy) : "";
180-
if (operation.Value.policy != null && operation.Value.policy.Contains("logger"))
179+
foreach (KeyValuePair<string, OperationsConfig> operation in api.operations)
181180
{
182-
// capture operation policy dependent on logger
183-
return true;
181+
string operationPolicy = operation.Value.policy != null ? fileReader.RetrieveLocalFileContents(operation.Value.policy) : "";
182+
if (operation.Value.policy != null && operation.Value.policy.Contains("logger"))
183+
{
184+
// capture operation policy dependent on logger
185+
return true;
186+
}
184187
}
185188
}
186189
return false;

0 commit comments

Comments
 (0)