From 5fedeb86717f087f9b4bcc47eaa9ded8310bc116 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Wed, 23 Sep 2015 19:06:55 -0700 Subject: [PATCH] If CVCode is 0, take the highest version. The Android client does this as well. --- index.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.go b/index.go index 66b0025..397e657 100644 --- a/index.go +++ b/index.go @@ -240,6 +240,12 @@ func LoadIndexXml(r io.Reader) (*Index, error) { } func (app *App) CurApk() *Apk { + if app.CVCode == 0 { + if len(app.Apks) > 0 { + return &app.Apks[0] + } + return nil + } for i := range app.Apks { apk := app.Apks[i] if app.CVCode >= apk.VCode {