diff --git a/frontend/src/metabase-lib/queries/StructuredQuery.ts b/frontend/src/metabase-lib/queries/StructuredQuery.ts index c82ee3ac0bbc8f9a86bb32c4471f2b17a7562efc..674bceff508c218457f7514f931837eb0775aec6 100644 --- a/frontend/src/metabase-lib/queries/StructuredQuery.ts +++ b/frontend/src/metabase-lib/queries/StructuredQuery.ts @@ -264,7 +264,11 @@ class StructuredQuery extends AtomicQuery { * @deprecated use metabase-lib v2 to manage joins */ joins = _.once((): JoinWrapper[] => { - return Q.getJoins(this.legacyQuery({ useStructuredQuery: true })).map( + const legacyQuery = this.legacyQuery({ useStructuredQuery: true }); + if (!legacyQuery) { + return []; + } + return Q.getJoins(legacyQuery).map( (join, index) => new JoinWrapper(join, index, this), ); });