We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c2a5f05 + ac19454 commit 27ba0beCopy full SHA for 27ba0be
1 file changed
examples/qr_code/src/main.rs
@@ -21,10 +21,7 @@ impl Sandbox for QRGenerator {
21
type Message = Message;
22
23
fn new() -> Self {
24
- QRGenerator {
25
- qr_code: qr_code::State::new("").ok(),
26
- ..Self::default()
27
- }
+ QRGenerator::default()
28
}
29
30
fn title(&self) -> String {
@@ -36,7 +33,12 @@ impl Sandbox for QRGenerator {
36
33
Message::DataChanged(mut data) => {
37
34
data.truncate(100);
38
35
39
- self.qr_code = qr_code::State::new(&data).ok();
+ self.qr_code = if data.is_empty() {
+ None
+ } else {
+ qr_code::State::new(&data).ok()
40
+ };
41
+
42
self.data = data;
43
44
0 commit comments