mirror of
https://github.com/Tilo-K/ddragon-cdn.git
synced 2026-01-09 16:41:01 +00:00
Added safety
This commit is contained in:
8
main.go
8
main.go
@@ -117,6 +117,9 @@ func getVersions() []string {
|
|||||||
|
|
||||||
res, err := http.Get(url)
|
res, err := http.Get(url)
|
||||||
checkError(err)
|
checkError(err)
|
||||||
|
if err != nil{
|
||||||
|
return nil
|
||||||
|
}
|
||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(res.Body)
|
body, err := ioutil.ReadAll(res.Body)
|
||||||
@@ -185,7 +188,10 @@ func getCurrentVersion() string {
|
|||||||
|
|
||||||
func loadCurrent() {
|
func loadCurrent() {
|
||||||
versions := getVersions()
|
versions := getVersions()
|
||||||
if getCurrentVersion() != versions[0] {
|
if versions == nil{
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if getCurrentVersion() != versions[0]{
|
||||||
file := loadDdragon(versions[0])
|
file := loadDdragon(versions[0])
|
||||||
ioutil.WriteFile("current.txt", []byte(versions[0]), 0777)
|
ioutil.WriteFile("current.txt", []byte(versions[0]), 0777)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user