This changes block ipnetwork creation if the "network" field
is empty.
---
 inc/ipnetwork.class.php |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/inc/ipnetwork.class.php b/inc/ipnetwork.class.php
index a194978..5eb063e 100644
--- a/inc/ipnetwork.class.php
+++ b/inc/ipnetwork.class.php
@@ -198,7 +198,10 @@ class IPNetwork extends CommonImplicitTreeDropdown {
       // Or if $this->fields["network"] != $input["network"] we a
updating the network
       $address = new IPAddress();
       $netmask = new IPNetmask();
-      if (!isset($this->fields["id"])
+      if (!$input["network"]) {
+         return array('error' => __('Invalid network address'),
+            'input' => false);
+      } else if (!isset($this->fields["id"])
           || ($input["network"] != $this->fields["network"])) {
          $network = explode ("/", $input["network"]);
          if (count($network) != 2) {
-- 
1.7.10

_______________________________________________
Glpi-dev mailing list
[email protected]
https://mail.gna.org/listinfo/glpi-dev

Reply via email to