From 16bf937bfab5ff00d64a2e3d99e0eaded473a77b Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Thu, 23 Feb 2023 06:19:42 +1300 Subject: [PATCH] vncserver: die if config wasn't loaded --- unix/KasmVNC/Config.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/unix/KasmVNC/Config.pm b/unix/KasmVNC/Config.pm index 2b199e4..7a5644a 100644 --- a/unix/KasmVNC/Config.pm +++ b/unix/KasmVNC/Config.pm @@ -34,7 +34,12 @@ sub load { failIfConfigNotReadable($self->{filename}); $logger->debug("Loading config " . $self->{filename}); - $self->{data} = YAML::Tiny->read($self->{filename})->[0]; + my $yamlDocuments = YAML::Tiny->read($self->{filename}); + unless (defined $yamlDocuments) { + die "Couldn't load config: $self-{filename}. Probable reason: No newline at end of file"; + } + + $self->{data} = $yamlDocuments->[0]; } sub get {