File tree 1 file changed +4
-6
lines changed
1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ export class ComplexityVisitor {
95
95
96
96
getFieldCostFactor ( ) {
97
97
const fieldDef = this . context . getFieldDef ( ) ;
98
- if ( fieldDef . getCostFactor ) {
98
+ if ( fieldDef && fieldDef . getCostFactor ) {
99
99
return fieldDef . getCostFactor ( ) ;
100
100
}
101
101
@@ -131,7 +131,7 @@ export class ComplexityVisitor {
131
131
132
132
getFieldCost ( ) {
133
133
const fieldDef = this . context . getFieldDef ( ) ;
134
- if ( fieldDef . getCost ) {
134
+ if ( fieldDef && fieldDef . getCost ) {
135
135
return fieldDef . getCost ( ) ;
136
136
}
137
137
@@ -155,13 +155,11 @@ export class ComplexityVisitor {
155
155
156
156
getDirectiveValue ( directiveName ) {
157
157
const fieldDef = this . context . getFieldDef ( ) ;
158
-
159
- const { astNode } = fieldDef ;
160
- if ( ! astNode || ! astNode . directives ) {
158
+ if ( ! fieldDef || ! fieldDef . astNode || ! fieldDef . astNode . directives ) {
161
159
return null ;
162
160
}
163
161
164
- const directive = astNode . directives . find (
162
+ const directive = fieldDef . astNode . directives . find (
165
163
( { name } ) => name . value === directiveName ,
166
164
) ;
167
165
if ( ! directive ) {
You can’t perform that action at this time.
0 commit comments