[pve-devel] [PATCH flutter_frontend] PveLxcOptions: fix config.unprivileged is null behavior

Aaron Lauterer a.lauterer at proxmox.com
Mon Nov 16 14:10:51 CET 2020


If config.unprivileged is null we should set it to the default (false)
so the ternary operator evaluates correctly.

Otherwise the LXC options screen shows "Failed assertion: boolean
expression must not be null" if the unprivileged config option is not
present in the config file.

Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
 lib/widgets/pve_lxc_options_widget.dart | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/widgets/pve_lxc_options_widget.dart b/lib/widgets/pve_lxc_options_widget.dart
index f0967fb..cc5b70c 100644
--- a/lib/widgets/pve_lxc_options_widget.dart
+++ b/lib/widgets/pve_lxc_options_widget.dart
@@ -76,7 +76,8 @@ class PveLxcOptions extends StatelessWidget {
                     ),
                     ListTile(
                       title: Text("Unprivileged"),
-                      subtitle: Text(config.unprivileged ? 'Yes' : 'No'),
+                      subtitle:
+                          Text(config.unprivileged ?? false ? 'Yes' : 'No'),
                     ),
                     ListTile(
                       title: Text("Features"),
-- 
2.20.1






More information about the pve-devel mailing list