summaryrefslogtreecommitdiffstats
path: root/screen_ui.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-06-13 20:22:50 +0200
committerTao Bao <tbao@google.com>2018-06-14 01:18:46 +0200
commitba4edb3e82d383a274cea979c9cacfd2e7f62568 (patch)
tree3222b6ac5b4c11c607f577328d28f07034a9cd54 /screen_ui.cpp
parentscreen_ui: Call gr_exit() from dtor. (diff)
downloadandroid_bootable_recovery-ba4edb3e82d383a274cea979c9cacfd2e7f62568.tar
android_bootable_recovery-ba4edb3e82d383a274cea979c9cacfd2e7f62568.tar.gz
android_bootable_recovery-ba4edb3e82d383a274cea979c9cacfd2e7f62568.tar.bz2
android_bootable_recovery-ba4edb3e82d383a274cea979c9cacfd2e7f62568.tar.lz
android_bootable_recovery-ba4edb3e82d383a274cea979c9cacfd2e7f62568.tar.xz
android_bootable_recovery-ba4edb3e82d383a274cea979c9cacfd2e7f62568.tar.zst
android_bootable_recovery-ba4edb3e82d383a274cea979c9cacfd2e7f62568.zip
Diffstat (limited to 'screen_ui.cpp')
-rw-r--r--screen_ui.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/screen_ui.cpp b/screen_ui.cpp
index e8444b6ca..f9c4a06c1 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -702,10 +702,10 @@ void ScreenRecoveryUI::SetSystemUpdateText(bool security_update) {
}
bool ScreenRecoveryUI::InitTextParams() {
- if (gr_init() < 0) {
+ // gr_init() would return successfully on font initialization failure.
+ if (gr_sys_font() == nullptr) {
return false;
}
-
gr_font_size(gr_sys_font(), &char_width_, &char_height_);
text_rows_ = (ScreenHeight() - kMarginHeight * 2) / char_height_;
text_cols_ = (ScreenWidth() - kMarginWidth * 2) / char_width_;
@@ -715,6 +715,10 @@ bool ScreenRecoveryUI::InitTextParams() {
bool ScreenRecoveryUI::Init(const std::string& locale) {
RecoveryUI::Init(locale);
+ if (gr_init() == -1) {
+ return false;
+ }
+
if (!InitTextParams()) {
return false;
}