mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Fix: file close even if file was not opened (#1417)
Fixed a bug where in many implementations of load-file functions the file-close was still executed even if the file-open resulted in an error.
This commit is contained in:
@@ -29,10 +29,10 @@ type Gallery struct {
|
||||
func LoadGalleryFile(filePath string) (*Gallery, error) {
|
||||
var gallery Gallery
|
||||
file, err := os.Open(filePath)
|
||||
defer file.Close()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer file.Close()
|
||||
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||
jsonParser := json.NewDecoder(file)
|
||||
err = jsonParser.Decode(&gallery)
|
||||
|
||||
Reference in New Issue
Block a user