@@ -99,6 +99,9 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *sqlserverfl
9999}
100100
101101func outputResult (p * print.Printer , outputFormat string , instance * sqlserverflex.Instance ) error {
102+ if instance == nil {
103+ return fmt .Errorf ("instance response is empty" )
104+ }
102105 switch outputFormat {
103106 case print .JSONOutputFormat :
104107 details , err := json .MarshalIndent (instance , "" , " " )
@@ -130,21 +133,24 @@ func outputResult(p *print.Printer, outputFormat string, instance *sqlserverflex
130133 table .AddSeparator ()
131134 table .AddRow ("STATUS" , utils .PtrString (instance .Status ))
132135 table .AddSeparator ()
133- table .AddRow ("STORAGE SIZE (GB)" , utils .PtrString (instance .Storage .Size ))
134- table .AddSeparator ()
136+ if instance .Storage != nil {
137+ table .AddRow ("STORAGE SIZE (GB)" , utils .PtrString (instance .Storage .Size ))
138+ table .AddSeparator ()
139+ }
135140 table .AddRow ("VERSION" , utils .PtrString (instance .Version ))
136141 table .AddSeparator ()
137142 table .AddRow ("BACKUP SCHEDULE (UTC)" , utils .PtrString (instance .BackupSchedule ))
138143 table .AddSeparator ()
139144 table .AddRow ("ACL" , acls )
140145 table .AddSeparator ()
141- table .AddRow ("FLAVOR DESCRIPTION" , utils .PtrString (instance .Flavor .Description ))
142- table .AddSeparator ()
143- table .AddRow ("CPU" , utils .PtrString (instance .Flavor .Cpu ))
144- table .AddSeparator ()
145- table .AddRow ("RAM (GB)" , utils .PtrString (instance .Flavor .Memory ))
146- table .AddSeparator ()
147-
146+ if instance .Flavor != nil {
147+ table .AddRow ("FLAVOR DESCRIPTION" , utils .PtrString (instance .Flavor .Description ))
148+ table .AddSeparator ()
149+ table .AddRow ("CPU" , utils .PtrString (instance .Flavor .Cpu ))
150+ table .AddSeparator ()
151+ table .AddRow ("RAM (GB)" , utils .PtrString (instance .Flavor .Memory ))
152+ table .AddSeparator ()
153+ }
148154 err := table .Display (p )
149155 if err != nil {
150156 return fmt .Errorf ("render table: %w" , err )
0 commit comments