Is the error you are getting “Cannot read property ‘length’ of null” per chance? Try this:
if (<b>condition.subConditions</b> && condition.subConditions.length...
That is the error. Is the condition built correctly in the first place?
Per our documentation, it should be an Array when defined. Search Conditions are a little different in that we add the programmatically though. I’ll look into it some more to see if it’s something we should treat as a bug (kind of low level, so we have to be careful when making changes), but in the meantime, does that change get your snippet working?