Browse Source

more verbose error when out of range

David Rose 21 years ago
parent
commit
66c6df9d92
1 changed files with 17 additions and 3 deletions
  1. 17 3
      direct/src/distributed/cDistributedSmoothNodeBase.cxx

+ 17 - 3
direct/src/distributed/cDistributedSmoothNodeBase.cxx

@@ -276,9 +276,23 @@ finish_send_update(DCPacker &packer) {
 
 
   packer.pop();
   packer.pop();
   bool pack_ok = packer.end_pack();
   bool pack_ok = packer.end_pack();
-  nassertv(pack_ok);
+  if (pack_ok) {
+    Datagram dg(packer.get_data(), packer.get_length());
+    _repository->send_datagram(dg);
 
 
-  Datagram dg(packer.get_data(), packer.get_length());
-  _repository->send_datagram(dg);
+  } else {
+#ifndef NDEBUG
+    if (packer.had_range_error()) {
+      ostringstream error;
+      error << "Node position out of range for DC file: "
+            << _node_path << " pos = " << _node_path.get_pos()
+            << " hpr = " << _node_path.get_hpr();
+      nassert_raise(error.str());
+
+    } else {
+      nassert_raise("Unexpected pack error in DC file.");
+    }
+#endif
+  }
 }
 }