File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ export class ComplexityVisitor {
9595
9696 getFieldCostFactor ( ) {
9797 const fieldDef = this . context . getFieldDef ( ) ;
98- if ( fieldDef . getCostFactor ) {
98+ if ( fieldDef && fieldDef . getCostFactor ) {
9999 return fieldDef . getCostFactor ( ) ;
100100 }
101101
@@ -131,7 +131,7 @@ export class ComplexityVisitor {
131131
132132 getFieldCost ( ) {
133133 const fieldDef = this . context . getFieldDef ( ) ;
134- if ( fieldDef . getCost ) {
134+ if ( fieldDef && fieldDef . getCost ) {
135135 return fieldDef . getCost ( ) ;
136136 }
137137
@@ -155,13 +155,11 @@ export class ComplexityVisitor {
155155
156156 getDirectiveValue ( directiveName ) {
157157 const fieldDef = this . context . getFieldDef ( ) ;
158-
159- const { astNode } = fieldDef ;
160- if ( ! astNode || ! astNode . directives ) {
158+ if ( ! fieldDef || ! fieldDef . astNode || ! fieldDef . astNode . directives ) {
161159 return null ;
162160 }
163161
164- const directive = astNode . directives . find (
162+ const directive = fieldDef . astNode . directives . find (
165163 ( { name } ) => name . value === directiveName ,
166164 ) ;
167165 if ( ! directive ) {
You can’t perform that action at this time.
0 commit comments