diff --git a/resources/switch.php b/resources/switch.php index ed15401005..2e8b37ba58 100644 --- a/resources/switch.php +++ b/resources/switch.php @@ -401,6 +401,12 @@ function save_var_xml() { //get the hostname $hostname = trim(event_socket_request_cmd('api switchname')); + if (strlen($hostname) == 0){ + $hostname = trim(gethostname()); + } + if (strlen($hostname) == 0){ + return; + } //build the xml $sql = "select * from v_vars ";