mirror of
				https://github.com/taigrr/wtf
				synced 2025-01-18 04:03:14 -08:00 
			
		
		
		
	Fix for potential runtime panic (#1046)
Switch error checking around, so we don't check the StatusCode before handling client errors.
This commit is contained in:
		
							parent
							
								
									7c3d476def
								
							
						
					
					
						commit
						ddfc439c41
					
				| @ -165,13 +165,14 @@ func (widget *Widget) getExistingChecks() ([]Checks, error) { | ||||
| 	req.Header.Set("X-Api-Key", widget.settings.apiKey) | ||||
| 	resp, err := http.DefaultClient.Do(req) | ||||
| 
 | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 
 | ||||
| 	if resp.StatusCode != 200 { | ||||
| 		return nil, fmt.Errorf(resp.Status) | ||||
| 	} | ||||
| 
 | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	defer func() { _ = resp.Body.Close() }() | ||||
| 
 | ||||
| 	var health Health | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user