Skip to content
Snippets Groups Projects
Commit af5672fb authored by Eric Biggers's avatar Eric Biggers Committed by Gerrit Code Review
Browse files

Merge "PolicyVersionUpgrader: fix ERROR + stacktrace on first boot" into main

parents b8e8e73b 1a36783c
No related branches found
No related tags found
No related merge requests found
Pipeline #14316 failed
......@@ -29,6 +29,7 @@ import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.util.ArrayList;
import java.util.List;
......@@ -251,6 +252,8 @@ public class PolicyVersionUpgrader {
String versionString = Files.readAllLines(
file.toPath(), Charset.defaultCharset()).get(0);
return Integer.parseInt(versionString);
} catch (NoSuchFileException e) {
return 0; // expected on first boot
} catch (IOException | NumberFormatException | IndexOutOfBoundsException e) {
Slog.e(LOG_TAG, "Error reading version", e);
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment