Add guard to anonymous function#423
Conversation
Fixes fairpm#412 Signed-off-by: Andy Fragen <andy@thefragens.com>
costdev
left a comment
There was a problem hiding this comment.
This change is fine as-is, though I'd also be curious whether the value being stored in the transient should be checked. If, for example, a release document should always have artifacts->package, if that's missing from a release document, we may consider skipping it, or possibly erroring, if needed.
|
If the transient didn't return an array wouldn't the error be different? |
It would, though I wasn't referring to the The cache is set here: fair-plugin/inc/packages/namespace.php Line 874 in 8f3ab3c So if Moreover:
|
|
Is this a product of the transient being an empty array? |
|
Nope, look at line 726 in the file touched by this PR - so the transient isn't an empty array. It's due to hitting a missing |
|
That's essentially what the guard protects. |
Fixes #412
Somehow
release->artifacts->packageis null and sending topick_artifact_by_lang()returns a type error. Adding a guard to the anonymous function should mitigate this issue.