Fixed error return condition when the toc is read.
Prior to this `getToc` could return (nil, nil) which caused a crash
later.
Test: m extract_apks && out/host/linux-x86/bin/extract_apks \
-o foo.apks -sdk-version=33 \
-abis=X86_64,X86,ARM64_V8A,ARMEABI_V7A \
-screen-densities=all -extract-single test.apks
where test.apks comes from ag/19673938
Test: vendor/google/modules/ArtGoogle/build-with-prebuilt-art-module.sh droid
with prebuilts in place for cf_x86_64_phone_prebuilt_art-userdebug
chained build on git_master_throttled
Bug: 246562532
Change-Id: Id849371b4dea04f08c07b201c8a466735b5b0994
diff --git a/cmd/extract_apks/main.go b/cmd/extract_apks/main.go
index 1cf64de..d200502 100644
--- a/cmd/extract_apks/main.go
+++ b/cmd/extract_apks/main.go
@@ -75,7 +75,7 @@
return nil, err
}
bytes := make([]byte, tocFile.FileHeader.UncompressedSize64)
- if _, err := rc.Read(bytes); err != io.EOF {
+ if _, err := rc.Read(bytes); err != nil && err != io.EOF {
return nil, err
}
rc.Close()