Skip to content

Commit 012a6fd

Browse files
committed
Fix NBGL object issues when null strings are provided
1 parent 2679ffa commit 012a6fd

File tree

4 files changed

+42
-13
lines changed

4 files changed

+42
-13
lines changed

.github/workflows/get_rust_apps.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
# Excluded Rust apps
1212
# app-kadena-legacy: has been replaced by app-kadena
1313
# app-pocket: does not build (Obsidians' Alamgu issue)
14-
# app-age: not maintained anymore
15-
excluded_apps = ["app-kadena-legacy", "app-pocket", "app-age"]
14+
excluded_apps = ["app-kadena-legacy", "app-pocket"]
1615

1716
# Retrieve all public apps on LedgerHQ GitHub organization
1817
token = sys.argv[1]

ledger_device_sdk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ledger_device_sdk"
3-
version = "1.22.8"
3+
version = "1.22.9"
44
authors = ["yhql", "yogh333", "agrojean-ledger", "kingofpayne"]
55
edition = "2021"
66
license.workspace = true

ledger_device_sdk/src/nbgl/nbgl_choice.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,22 @@ impl<'a> NbglChoice<'a> {
7373
self.ux_sync_init();
7474
nbgl_useCaseChoice(
7575
&icon as *const nbgl_icon_details_t,
76-
message.as_ptr() as *const c_char,
77-
sub_message.as_ptr() as *const c_char,
78-
confirm_text.as_ptr() as *const c_char,
79-
cancel_text.as_ptr() as *const c_char,
76+
match message.is_empty() {
77+
true => core::ptr::null(),
78+
false => message.as_ptr() as *const c_char,
79+
},
80+
match sub_message.is_empty() {
81+
true => core::ptr::null(),
82+
false => sub_message.as_ptr() as *const c_char,
83+
},
84+
match confirm_text.is_empty() {
85+
true => core::ptr::null(),
86+
false => confirm_text.as_ptr() as *const c_char,
87+
},
88+
match cancel_text.is_empty() {
89+
true => core::ptr::null(),
90+
false => cancel_text.as_ptr() as *const c_char,
91+
},
8092
Some(choice_callback),
8193
);
8294
let sync_ret = self.ux_sync_wait(false);

ledger_device_sdk/src/nbgl/nbgl_review.rs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,18 @@ impl<'a> NbglReview<'a> {
107107
self.tx_type.to_c_type(false),
108108
&tag_value_list as *const nbgl_contentTagValueList_t,
109109
&icon as *const nbgl_icon_details_t,
110-
self.title.as_ptr() as *const c_char,
111-
self.subtitle.as_ptr() as *const c_char,
112-
self.finish_title.as_ptr() as *const c_char,
110+
match self.title.is_empty() {
111+
true => core::ptr::null(),
112+
false => self.title.as_ptr() as *const c_char,
113+
},
114+
match self.subtitle.is_empty() {
115+
true => core::ptr::null(),
116+
false => self.subtitle.as_ptr() as *const c_char,
117+
},
118+
match self.finish_title.is_empty() {
119+
true => core::ptr::null(),
120+
false => self.finish_title.as_ptr() as *const c_char,
121+
},
113122
core::ptr::null(),
114123
Some(choice_callback),
115124
);
@@ -120,9 +129,18 @@ impl<'a> NbglReview<'a> {
120129
self.tx_type.to_c_type(false),
121130
&tag_value_list as *const nbgl_contentTagValueList_t,
122131
&icon as *const nbgl_icon_details_t,
123-
self.title.as_ptr() as *const c_char,
124-
self.subtitle.as_ptr() as *const c_char,
125-
self.finish_title.as_ptr() as *const c_char,
132+
match self.title.is_empty() {
133+
true => core::ptr::null(),
134+
false => self.title.as_ptr() as *const c_char,
135+
},
136+
match self.subtitle.is_empty() {
137+
true => core::ptr::null(),
138+
false => self.subtitle.as_ptr() as *const c_char,
139+
},
140+
match self.finish_title.is_empty() {
141+
true => core::ptr::null(),
142+
false => self.finish_title.as_ptr() as *const c_char,
143+
},
126144
Some(choice_callback),
127145
);
128146
} else {

0 commit comments

Comments
 (0)