File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -435,13 +435,18 @@ class CodeChunks {
435
435
436
436
static String backlinkRelInfo (ModelEntity entity, ModelBacklink bl) {
437
437
final srcEntity = entity.model.findEntityByName (bl.srcEntity);
438
+ if (srcEntity == null ) {
439
+ throw InvalidGenerationSourceError (
440
+ 'Invalid relation backlink ${entity .name }.${bl .name } '
441
+ '- source entity ${bl .srcEntity } not found.' );
442
+ }
438
443
439
444
// either of these will be set, based on the source field that matches
440
445
ModelRelation ? srcRel;
441
446
ModelProperty ? srcProp;
442
447
443
448
if (bl.srcField.isEmpty) {
444
- final matchingProps = srcEntity! .properties
449
+ final matchingProps = srcEntity.properties
445
450
.where ((p) => p.isRelation && p.relationTarget == entity.name);
446
451
final matchingRels =
447
452
srcEntity.relations.where ((r) => r.targetId == entity.id);
@@ -457,7 +462,7 @@ class CodeChunks {
457
462
srcRel = matchingRels.first;
458
463
}
459
464
} else {
460
- srcProp = srcEntity! .findPropertyByName (bl.srcField);
465
+ srcProp = srcEntity.findPropertyByName (bl.srcField);
461
466
if (srcProp == null ) {
462
467
srcRel =
463
468
srcEntity.relations.firstWhereOrNull ((r) => r.name == bl.srcField);
You can’t perform that action at this time.
0 commit comments