mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-25 11:26:47 +01:00
Better check for fw version major (#30)
This commit is contained in:
parent
910d9ef398
commit
e92c9dbbb5
@ -38,7 +38,7 @@ public class MiBandFWHelper {
|
|||||||
|
|
||||||
try (InputStream in = new BufferedInputStream(cr.openInputStream(uri))){
|
try (InputStream in = new BufferedInputStream(cr.openInputStream(uri))){
|
||||||
this.fw = FileUtils.readAll(in, 1024 * 1024); // 1 MB
|
this.fw = FileUtils.readAll(in, 1024 * 1024); // 1 MB
|
||||||
if (fw.length > firmwareVersionMajor && fw[firmwareVersionMajor] != 1) {
|
if (fw.length <= firmwareVersionMajor || fw[firmwareVersionMajor] != 1) {
|
||||||
throw new IOException("Firmware major version should be 1, probably this isn't a MiBand firmware.");
|
throw new IOException("Firmware major version should be 1, probably this isn't a MiBand firmware.");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user