From f93a4efce177cc0dff643cdb92f988bd09a91840 Mon Sep 17 00:00:00 2001 From: cuu Date: Sat, 8 Dec 2018 13:48:12 +0800 Subject: [PATCH] bug fix --- sysgo/UI/Emulator/rom_so_confirm_page.go | 5 +++-- sysgo/UI/util_funcs.go | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sysgo/UI/Emulator/rom_so_confirm_page.go b/sysgo/UI/Emulator/rom_so_confirm_page.go index 364cbab..380c382 100644 --- a/sysgo/UI/Emulator/rom_so_confirm_page.go +++ b/sysgo/UI/Emulator/rom_so_confirm_page.go @@ -80,9 +80,10 @@ func (self *RomSoConfirmPage) KeyDown(ev *event.Event) { } if ev.Data["Key"] == UI.CurKeys["B"] { - if UI.CheckBattery < 5 { + bat := UI.CheckBattery() + if bat < 5 && bat >= 0 { self.SnapMsg("Battery must over 5%") - }else { + }else { // -1 or something else, if self.DownloadPage == nil { self.DownloadPage = UI.NewDownloadProcessPage() self.DownloadPage.Screen = self.Screen diff --git a/sysgo/UI/util_funcs.go b/sysgo/UI/util_funcs.go index 2c5e9ce..8ea615e 100644 --- a/sysgo/UI/util_funcs.go +++ b/sysgo/UI/util_funcs.go @@ -215,8 +215,8 @@ func GetUid(path string) int { } func CheckBattery() int { - if UI.FileExists(sysgo.Battery) == false { - return + if FileExists(sysgo.Battery) == false { + return -1 } batinfos,err := ReadLines(sysgo.Battery) if err == nil {