Skip to content

Commit

Permalink
Change the way we parse the binary protocol buffers to see if it fixes (
Browse files Browse the repository at this point in the history
#364)

the crashes on some devices.
  • Loading branch information
jaydeetay authored Oct 14, 2020
1 parent 5d965a7 commit 6c5e604
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "com.google.android.stardroid"
minSdkVersion 16
targetSdkVersion 30
versionCode 1518
versionName "1.9.6 - RC1"
versionCode 1519
versionName "1.9.6 - RC2"
buildConfigField 'String', 'GOOGLE_ANALYTICS_CODE', '""'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.google.android.stardroid.util.Blog;
import com.google.android.stardroid.util.MiscUtil;
import com.google.common.io.Closeables;
import com.google.protobuf.Parser;

import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -77,10 +78,10 @@ private void readSourceFile(String sourceFilename) {
InputStream in = null;
try {
in = assetManager.open(sourceFilename, AssetManager.ACCESS_BUFFER);
AstronomicalSourcesProto.Builder builder = AstronomicalSourcesProto.newBuilder();
builder.mergeFrom(in);
Parser<AstronomicalSourcesProto> parser = AstronomicalSourcesProto.parser();
AstronomicalSourcesProto sources = parser.parseFrom(in);

for (AstronomicalSourceProto proto : builder.build().getSourceList()) {
for (AstronomicalSourceProto proto : sources.getSourceList()) {
fileSources.add(new ProtobufAstronomicalSource(proto, getResources()));
}
Log.d(TAG, "Found: " + fileSources.size() + " sources");
Expand Down

0 comments on commit 6c5e604

Please sign in to comment.