浏览代码

general: use nassert_raise instead of nassertv(false) et al

Even a brief error message in the assertion is infinitely more useful to a user who is not at home in the source code, especially for assertions that may reasonably be triggered by honest user mistakes.
rdb 7 年之前
父节点
当前提交
97d4e32a06
共有 45 个文件被更改,包括 108 次插入79 次删除
  1. 1 1
      direct/src/dcparser/dcClass.cxx
  2. 1 1
      dtool/src/prc/notifyCategory.cxx
  3. 1 1
      panda/src/chan/animChannelMatrixXfmTable.cxx
  4. 1 1
      panda/src/chan/animChannelScalarTable.cxx
  5. 1 1
      panda/src/display/graphicsStateGuardian.cxx
  6. 2 1
      panda/src/egg/eggGroup.cxx
  7. 2 1
      panda/src/egg/eggVertexPool.cxx
  8. 2 1
      panda/src/egg/eggXfmAnimData.cxx
  9. 2 1
      panda/src/egg/eggXfmSAnim.cxx
  10. 1 1
      panda/src/event/asyncFuture.cxx
  11. 2 2
      panda/src/event/pointerEvent.cxx
  12. 1 1
      panda/src/glstuff/glGeomContext_src.cxx
  13. 2 2
      panda/src/glstuff/glGraphicsStateGuardian_src.cxx
  14. 1 1
      panda/src/gobj/geom.cxx
  15. 1 1
      panda/src/gobj/geomCacheManager.cxx
  16. 4 4
      panda/src/gobj/geomPrimitive.cxx
  17. 1 1
      panda/src/gobj/geomTrifans.cxx
  18. 1 1
      panda/src/gobj/geomVertexArrayData.cxx
  19. 2 1
      panda/src/gobj/geomVertexData.cxx
  20. 1 1
      panda/src/gobj/shader.cxx
  21. 8 5
      panda/src/gobj/texture.cxx
  22. 1 1
      panda/src/gsgbase/graphicsStateGuardianBase.cxx
  23. 3 3
      panda/src/nativenet/socket_address.I
  24. 2 2
      panda/src/nativenet/socket_address.cxx
  25. 2 1
      panda/src/net/connection.cxx
  26. 2 1
      panda/src/net/datagramTCPHeader.cxx
  27. 1 1
      panda/src/parametrics/parametricCurveCollection.cxx
  28. 4 4
      panda/src/pgraph/clipPlaneAttrib.cxx
  29. 1 1
      panda/src/pgraph/cullBinManager.cxx
  30. 4 4
      panda/src/pgraph/lightAttrib.cxx
  31. 6 3
      panda/src/pgraph/nodePath.cxx
  32. 2 1
      panda/src/pgraph/pandaNode.cxx
  33. 1 1
      panda/src/pgraph/renderAttribRegistry.cxx
  34. 2 1
      panda/src/pgraph/sceneGraphReducer.cxx
  35. 1 1
      panda/src/pgraphnodes/ambientLight.cxx
  36. 2 1
      panda/src/pipeline/pythonThread.cxx
  37. 16 8
      panda/src/pnmimage/pfmFile.cxx
  38. 10 8
      panda/src/pnmimage/pnmImage.cxx
  39. 2 1
      panda/src/pnmimagetypes/pnmFileTypePfm.cxx
  40. 2 1
      panda/src/pnmimagetypes/pnmFileTypeSGIWriter.cxx
  41. 1 1
      panda/src/putil/sparseArray.I
  42. 1 1
      panda/src/text/textAssembler.cxx
  43. 2 1
      panda/src/vision/webcamVideoCursorV4L.cxx
  44. 1 1
      pandatool/src/assimp/pandaIOSystem.cxx
  45. 1 1
      pandatool/src/eggcharbase/eggBackPointer.cxx

+ 1 - 1
direct/src/dcparser/dcClass.cxx

@@ -1240,7 +1240,7 @@ shadow_inherited_field(const string &name) {
   }
 
   // If we get here, the named field wasn't in the list.  Huh.
-  nassertv(false);
+  nassert_raise("named field not in list");
 }
 
 /**

+ 1 - 1
dtool/src/prc/notifyCategory.cxx

@@ -110,7 +110,7 @@ out(NotifySeverity severity, bool prefix) const {
       nout << *this << "(" << severity << "): ";
     }
     if (assert_abort) {
-      nassertr(false, nout);
+      nassert_raise("unprotected debug statement");
     }
 
     return nout;

+ 1 - 1
panda/src/chan/animChannelMatrixXfmTable.cxx

@@ -239,7 +239,7 @@ set_table(char table_id, const CPTA_stdfloat &table) {
   if (table.size() > 1 && (int)table.size() < num_frames) {
     // The new table has an invalid number of frames--it doesn't match the
     // bundle's requirement.
-    nassertv(false);
+    nassert_raise("mismatched number of frames");
     return;
   }
 

+ 1 - 1
panda/src/chan/animChannelScalarTable.cxx

@@ -104,7 +104,7 @@ set_table(const CPTA_stdfloat &table) {
   if (table.size() > 1 && (int)table.size() < num_frames) {
     // The new table has an invalid number of frames--it doesn't match the
     // bundle's requirement.
-    nassertv(false);
+    nassert_raise("mismatched number of frames");
     return;
   }
 

+ 1 - 1
panda/src/display/graphicsStateGuardian.cxx

@@ -743,7 +743,7 @@ issue_timer_query(int pstats_index) {
  */
 void GraphicsStateGuardian::
 dispatch_compute(int num_groups_x, int num_groups_y, int num_groups_z) {
-  nassertv(false /* Compute shaders not supported by GSG */);
+  nassert_raise("Compute shaders not supported by GSG");
 }
 
 /**

+ 2 - 1
panda/src/egg/eggGroup.cxx

@@ -192,7 +192,8 @@ write(ostream &out, int indent_level) const {
 
   default:
     // invalid group type
-    nassertv(false);
+    nassert_raise("invalid EggGroup type");
+    return;
   }
 
   if (is_of_type(EggBin::get_class_type())) {

+ 2 - 1
panda/src/egg/eggVertexPool.cxx

@@ -445,7 +445,8 @@ add_vertex(EggVertex *vertex, int index) {
     }
 
     // Oops, you duplicated a vertex index.
-    nassertr(false, nullptr);
+    nassert_raise("duplicate vertex index");
+    return nullptr;
   }
 
   _unique_vertices.insert(vertex);

+ 2 - 1
panda/src/egg/eggXfmAnimData.cxx

@@ -142,7 +142,8 @@ get_value(int row, LMatrix4d &mat) const {
 
     default:
       // The contents string contained an invalid letter.
-      nassertv(false);
+      nassert_raise("invalid letter in contents string");
+      return;
     }
   }
 

+ 2 - 1
panda/src/egg/eggXfmSAnim.cxx

@@ -368,7 +368,8 @@ get_value(int row, LMatrix4d &mat) const {
 
       default:
         // One of the child tables had an invalid name.
-        nassertv(false);
+        nassert_raise("invalid name in child table");
+        return;
       }
     }
   }

+ 1 - 1
panda/src/event/asyncFuture.cxx

@@ -298,7 +298,7 @@ wake_task(AsyncTask *task) {
     return;
 
   default:
-    nassertv(false);
+    nassert_raise("unexpected task state");
     return;
   }
 }

+ 2 - 2
panda/src/event/pointerEvent.cxx

@@ -29,7 +29,7 @@ output(std::ostream &out) const {
  */
 void PointerEvent::
 write_datagram(Datagram &dg) const {
-  nassertv(false && "This function not implemented yet.");
+  nassert_raise("This function not implemented yet.");
 }
 
 /**
@@ -37,5 +37,5 @@ write_datagram(Datagram &dg) const {
  */
 void PointerEvent::
 read_datagram(DatagramIterator &scan) {
-  nassertv(false && "This function not implemented yet.");
+  nassert_raise("This function not implemented yet.");
 }

+ 1 - 1
panda/src/glstuff/glGeomContext_src.cxx

@@ -32,7 +32,7 @@ get_display_list(GLuint &index, const CLP(GeomMunger) *munger,
                  UpdateSeq modified) {
 #if defined(OPENGLES) || !defined(SUPPORT_FIXED_FUNCTION)
   // Display lists not supported by OpenGL ES.
-  nassertr(false, false);
+  nassert_raise("OpenGL ES does not support display lists");
   return false;
 
 #else

+ 2 - 2
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -14144,8 +14144,8 @@ extract_texture_image(PTA_uchar &image, size_t &page_size,
                       Texture::ComponentType type,
                       Texture::CompressionMode compression, int n) {
 #ifdef OPENGLES  // Extracting texture data unsupported in OpenGL ES.
-    nassertr(false, false);
-    return false;
+  nassert_raise("OpenGL ES does not support extracting texture data");
+  return false;
 #else
 
   // Make sure the GL driver does not align textures, otherwise we get corrupt

+ 1 - 1
panda/src/gobj/geom.cxx

@@ -1504,7 +1504,7 @@ clear_prepared(PreparedGraphicsObjects *prepared_objects) {
   } else {
     // If this assertion fails, clear_prepared() was given a prepared_objects
     // that the geom didn't know about.
-    nassertv(false);
+    nassert_raise("unknown PreparedGraphicsObjects");
   }
 }
 

+ 1 - 1
panda/src/gobj/geomCacheManager.cxx

@@ -47,7 +47,7 @@ GeomCacheManager() :
 GeomCacheManager::
 ~GeomCacheManager() {
   // Shouldn't be deleting this global object.
-  nassertv(false);
+  nassert_raise("attempt to delete GeomCacheManager");
 }
 
 /**

+ 4 - 4
panda/src/gobj/geomPrimitive.cxx

@@ -221,7 +221,7 @@ add_vertex(int vertex) {
       ((uint32_t *)ptr)[num_rows] = vertex;
       break;
     default:
-      nassertv(false);
+      nassert_raise("unsupported index type");
       break;
     }
   }
@@ -1510,7 +1510,7 @@ clear_prepared(PreparedGraphicsObjects *prepared_objects) {
   } else {
     // If this assertion fails, clear_prepared() was given a prepared_objects
     // which the data array didn't know about.
-    nassertv(false);
+    nassert_raise("unknown PreparedGraphicsObjects");
   }
 }
 
@@ -2230,7 +2230,7 @@ get_vertex(int i) const {
       return ((uint32_t *)ptr)[i];
       break;
     default:
-      nassertr(false, -1);
+      nassert_raise("unsupported index type");
       return -1;
     }
 
@@ -2296,7 +2296,7 @@ get_referenced_vertices(BitArray &bits) const {
       }
       break;
     default:
-      nassertv(false);
+      nassert_raise("unsupported index type");
       break;
     }
   } else {

+ 1 - 1
panda/src/gobj/geomTrifans.cxx

@@ -139,7 +139,7 @@ CPT(GeomVertexArrayData) GeomTrifans::
 rotate_impl() const {
   // Actually, we can't rotate fans without chaging the winding order.  It's
   // an error to define a flat shade model for a GeomTrifan.
-  nassertr(false, nullptr);
+  nassert_raise("GeomTrifans cannot have flat shading model");
   return nullptr;
 }
 

+ 1 - 1
panda/src/gobj/geomVertexArrayData.cxx

@@ -351,7 +351,7 @@ clear_prepared(PreparedGraphicsObjects *prepared_objects) {
   } else {
     // If this assertion fails, clear_prepared() was given a prepared_objects
     // which the data array didn't know about.
-    nassertv(false);
+    nassert_raise("unknown PreparedGraphicsObjects");
   }
 }
 

+ 2 - 1
panda/src/gobj/geomVertexData.cxx

@@ -1121,7 +1121,8 @@ do_set_color(GeomVertexData *vdata, const LColor &color) {
   const GeomVertexColumn *column;
   int array_index;
   if (!format->get_array_info(InternalName::get_color(), array_index, column)) {
-    nassertv(false);
+    nassert_raise("no color column");
+    return;
   }
 
   size_t stride = format->get_array(array_index)->get_stride();

+ 1 - 1
panda/src/gobj/shader.cxx

@@ -3705,7 +3705,7 @@ clear_prepared(PreparedGraphicsObjects *prepared_objects) {
   } else {
     // If this assertion fails, clear_prepared() was given a prepared_objects
     // which the texture didn't know about.
-    nassertv(false);
+    nassert_raise("unknown PreparedGraphicsObjects");
   }
 }
 

+ 8 - 5
panda/src/gobj/texture.cxx

@@ -4897,8 +4897,8 @@ do_read_ktx(CData *cdata, istream &in, const string &filename, bool header_only)
             }
             break;
           default:
-            nassertr(false, false);
-            break;
+            nassert_raise("unexpected channel count");
+            return false;
           }
         }
 
@@ -6591,8 +6591,9 @@ do_reconsider_image_properties(CData *cdata, int x_size, int y_size, int num_com
 
     default:
       // Eh?
-      nassertr(false, false);
+      nassert_raise("unexpected channel count");
       cdata->_format = F_rgb;
+      return false;
     }
   }
 
@@ -7989,7 +7990,8 @@ convert_from_pfm(PTA_uchar &image, size_t page_size, int z,
     break;
 
   default:
-    nassertv(false);
+    nassert_raise("unexpected channel count");
+    return;
   }
 
   nassertv((unsigned char *)p == &image[idx] + page_size);
@@ -8199,7 +8201,8 @@ convert_to_pfm(PfmFile &pfm, int x_size, int y_size,
     break;
 
   default:
-    nassertr(false, false);
+    nassert_raise("unexpected channel count");
+    return false;
   }
 
   nassertr((unsigned char *)p == &image[idx] + page_size, false);

+ 1 - 1
panda/src/gsgbase/graphicsStateGuardianBase.cxx

@@ -54,7 +54,7 @@ set_default_gsg(GraphicsStateGuardianBase *default_gsg) {
   LightMutexHolder holder(gsg_list->_lock);
   if (find(gsg_list->_gsgs.begin(), gsg_list->_gsgs.end(), default_gsg) == gsg_list->_gsgs.end()) {
     // The specified GSG doesn't exist or it has already destructed.
-    nassertv(false);
+    nassert_raise("GSG not found or already destructed");
     return;
   }
 

+ 3 - 3
panda/src/nativenet/socket_address.I

@@ -43,7 +43,7 @@ Socket_Address(const struct sockaddr &inaddr) {
     _addr6 = (const sockaddr_in6 &)inaddr;
 
   } else {
-    nassertv(false);
+    nassert_raise("unsupported address family");
     clear();
   }
 }
@@ -106,7 +106,7 @@ operator == (const Socket_Address &in) const {
   }
 
   // Unsupported address family.
-  nassertr(false, false);
+  nassert_raise("unsupported address family");
   return false;
 }
 
@@ -224,7 +224,7 @@ operator < (const Socket_Address &in) const {
   }
 
   // Unsupported address family.
-  nassertr(false, false);
+  nassert_raise("unsupported address family");
   return false;
 }
 

+ 2 - 2
panda/src/nativenet/socket_address.cxx

@@ -98,7 +98,7 @@ get_ip() const {
     getnameinfo(&_addr, sizeof(sockaddr_in6), buf, sizeof(buf), nullptr, 0, NI_NUMERICHOST);
 
   } else {
-    nassertr(false, std::string());
+    nassert_raise("unsupported address family");
   }
 
   return std::string(buf);
@@ -124,7 +124,7 @@ get_ip_port() const {
     sprintf(buf + strlen(buf), "]:%hu", get_port());
 
   } else {
-    nassertr(false, std::string());
+    nassert_raise("unsupported address family");
   }
 
   return std::string(buf);

+ 2 - 1
panda/src/net/connection.cxx

@@ -478,7 +478,8 @@ check_send_error(bool okflag) {
   if (!okflag) {
     static ConfigVariableBool abort_send_error("abort-send-error", false);
     if (abort_send_error) {
-      nassertr(false, false);
+      nassert_raise("send error");
+      return false;
     }
 
     // Assume any error means the connection has been reset; tell our manager

+ 2 - 1
panda/src/net/datagramTCPHeader.cxx

@@ -46,7 +46,8 @@ DatagramTCPHeader(const NetDatagram &datagram, int header_size) {
     break;
 
   default:
-    nassertv(false);
+    nassert_raise("invalid header size");
+    return;
   }
 
   nassertv((int)_header.get_length() == header_size);

+ 1 - 1
panda/src/parametrics/parametricCurveCollection.cxx

@@ -276,7 +276,7 @@ get_timewarp_curve(int n) const {
       n--;
     }
   }
-  nassertr(false, nullptr);
+  nassert_raise("index out of range");
   return nullptr;
 }
 

+ 4 - 4
panda/src/pgraph/clipPlaneAttrib.cxx

@@ -72,7 +72,7 @@ make(ClipPlaneAttrib::Operation op, PlaneNode *plane) {
     return attrib;
   }
 
-  nassertr(false, make());
+  nassert_raise("invalid operation");
   return make();
 }
 
@@ -110,7 +110,7 @@ make(ClipPlaneAttrib::Operation op, PlaneNode *plane1, PlaneNode *plane2) {
     return attrib;
   }
 
-  nassertr(false, make());
+  nassert_raise("invalid operation");
   return make();
 }
 
@@ -152,7 +152,7 @@ make(ClipPlaneAttrib::Operation op, PlaneNode *plane1, PlaneNode *plane2,
     return attrib;
   }
 
-  nassertr(false, make());
+  nassert_raise("invalid operation");
   return make();
 }
 
@@ -197,7 +197,7 @@ make(ClipPlaneAttrib::Operation op, PlaneNode *plane1, PlaneNode *plane2,
     return attrib;
   }
 
-  nassertr(false, make());
+  nassert_raise("invalid operation");
   return make();
 }
 

+ 1 - 1
panda/src/pgraph/cullBinManager.cxx

@@ -199,7 +199,7 @@ make_new_bin(int bin_index, GraphicsStateGuardianBase *gsg,
   }
 
   // Hmm, unknown (or unregistered) bin type.
-  nassertr(false, nullptr);
+  nassert_raise("unknown bin type");
   return nullptr;
 }
 

+ 4 - 4
panda/src/pgraph/lightAttrib.cxx

@@ -116,7 +116,7 @@ make(LightAttrib::Operation op, Light *light) {
     return attrib;
   }
 
-  nassertr(false, make());
+  nassert_raise("invalid operation");
   return make();
 }
 
@@ -154,7 +154,7 @@ make(LightAttrib::Operation op, Light *light1, Light *light2) {
     return attrib;
   }
 
-  nassertr(false, make());
+  nassert_raise("invalid operation");
   return make();
 }
 
@@ -196,7 +196,7 @@ make(LightAttrib::Operation op, Light *light1, Light *light2,
     return attrib;
   }
 
-  nassertr(false, make());
+  nassert_raise("invalid operation");
   return make();
 }
 
@@ -241,7 +241,7 @@ make(LightAttrib::Operation op, Light *light1, Light *light2,
     return attrib;
   }
 
-  nassertr(false, make());
+  nassert_raise("invalid operation");
   return make();
 }
 

+ 6 - 3
panda/src/pgraph/nodePath.cxx

@@ -718,7 +718,8 @@ get_state(const NodePath &other, Thread *current_thread) const {
     } else {
       pgraph_cat.error()
         << *this << " is not related to " << other << "\n";
-      nassertr(false, RenderState::make_empty());
+      nassert_raise("unrelated nodes");
+      return RenderState::make_empty();
     }
   }
 
@@ -792,7 +793,8 @@ get_transform(const NodePath &other, Thread *current_thread) const {
     } else {
       pgraph_cat.error()
         << *this << " is not related to " << other << "\n";
-      nassertr(false, TransformState::make_identity());
+      nassert_raise("unrelated nodes");
+      return TransformState::make_identity();
     }
   }
 
@@ -877,7 +879,8 @@ get_prev_transform(const NodePath &other, Thread *current_thread) const {
     } else {
       pgraph_cat.error()
         << *this << " is not related to " << other << "\n";
-      nassertr(false, TransformState::make_identity());
+      nassert_raise("unrelated nodes");
+      return TransformState::make_identity();
     }
   }
 

+ 2 - 1
panda/src/pgraph/pandaNode.cxx

@@ -2383,7 +2383,8 @@ r_copy_subgraph(PandaNode::InstanceMap &inst_map, Thread *current_thread) const
       << "Don't know how to copy nodes of type " << get_type() << "\n";
 
     if (no_unsupported_copy) {
-      nassertr(false, nullptr);
+      nassert_raise("unsupported copy");
+      return nullptr;
     }
   }
 

+ 1 - 1
panda/src/pgraph/renderAttribRegistry.cxx

@@ -78,7 +78,7 @@ register_slot(TypeHandle type_handle, int sort, RenderAttrib *default_attrib) {
     pgraph_cat->error()
       << "Too many registered RenderAttribs; not registering "
       << type_handle << "\n";
-    nassertr(false, 0);
+    nassert_raise("out of RenderAttrib slots");
     return 0;
   }
 

+ 2 - 1
panda/src/pgraph/sceneGraphReducer.cxx

@@ -333,7 +333,8 @@ r_apply_attribs(PandaNode *node, const AccumulatedAttribs &attribs,
             << child_node->get_type() << "\n";
 
           if (no_unsupported_copy) {
-            nassertv(false);
+            nassert_raise("unsupported copy");
+            return;
           }
           resist_copy = true;
 

+ 1 - 1
panda/src/pgraphnodes/ambientLight.cxx

@@ -85,7 +85,7 @@ void AmbientLight::
 bind(GraphicsStateGuardianBase *, const NodePath &, int) {
   // AmbientLights aren't bound to light id's; this function should never be
   // called.
-  nassertv(false);
+  nassert_raise("cannot bind AmbientLight");
 }
 
 /**

+ 2 - 1
panda/src/pipeline/pythonThread.cxx

@@ -161,7 +161,8 @@ call_python_func(PyObject *function, PyObject *args) {
 #ifndef HAVE_THREADS
     // Shouldn't be possible to come here without having some kind of
     // threading support enabled.
-    nassertr(false, nullptr);
+    nassert_raise("threading support disabled");
+    return nullptr;
 #else
 
 #ifdef SIMPLE_THREADS

+ 16 - 8
panda/src/pnmimage/pfmFile.cxx

@@ -346,7 +346,8 @@ load(const PNMImage &pnmimage) {
     break;
 
   default:
-    nassertr(false, false);
+    nassert_raise("unexpected channel count");
+    return false;
   }
   return true;
 }
@@ -410,7 +411,8 @@ store(PNMImage &pnmimage) const {
     break;
 
   default:
-    nassertr(false, false);
+    nassert_raise("unexpected channel count");
+    return false;
   }
   return true;
 }
@@ -877,7 +879,8 @@ set_no_data_nan(int num_channels) {
       _has_point = has_point_nan_4;
       break;
     default:
-      nassertv(false);
+      nassert_raise("unexpected channel count");
+      break;
     }
   } else {
     clear_no_data_value();
@@ -909,7 +912,8 @@ set_no_data_value(const LPoint4f &no_data_value) {
     _has_point = has_point_4;
     break;
   default:
-    nassertv(false);
+    nassert_raise("unexpected channel count");
+    break;
   }
 }
 
@@ -938,7 +942,8 @@ set_no_data_threshold(const LPoint4f &no_data_value) {
     _has_point = has_point_threshold_4;
     break;
   default:
-    nassertv(false);
+    nassert_raise("unexpected channel count");
+    break;
   }
 }
 
@@ -1121,7 +1126,8 @@ quick_filter_from(const PfmFile &from) {
     break;
 
   default:
-    nassertv(false);
+    nassert_raise("unexpected channel count");
+    return;
   }
 
   new_data.push_back(0.0);
@@ -1826,7 +1832,8 @@ compute_planar_bounds(const LPoint2f &center, PN_float32 point_dist, PN_float32
     break;
 
   default:
-    nassertr(false, nullptr);
+    nassert_raise("invalid coordinate system");
+    return nullptr;
   }
 
   // Rotate the bounding volume back into the original space of the screen.
@@ -1879,7 +1886,8 @@ compute_sample_point(LPoint3f &result,
     break;
 
   default:
-    nassertv(false);
+    nassert_raise("unexpected channel count");
+    break;
   }
 }
 

+ 10 - 8
panda/src/pnmimage/pnmImage.cxx

@@ -596,8 +596,8 @@ set_color_space(ColorSpace color_space) {
       break;
 
     default:
-      nassertv(false);
-      break;
+      nassert_raise("invalid color space");
+      return;
     }
 
     // Initialize the new encoding settings.
@@ -852,7 +852,7 @@ get_channel_val(int x, int y, int channel) const {
     pnmimage_cat.error()
       << "Invalid request for channel " << channel << " in "
       << get_num_channels() << "-channel image.\n";
-    nassertr(false, 0);
+    nassert_raise("unexpected channel count");
     return 0;
   }
 }
@@ -888,7 +888,8 @@ set_channel_val(int x, int y, int channel, xelval value) {
     break;
 
   default:
-    nassertv(false);
+    nassert_raise("unexpected channel count");
+    break;
   }
 }
 
@@ -918,7 +919,7 @@ get_channel(int x, int y, int channel) const {
     pnmimage_cat.error()
       << "Invalid request for channel " << channel << " in "
       << get_num_channels() << "-channel image.\n";
-    nassertr(false, 0);
+    nassert_raise("unexpected channel count");
     return 0;
   }
 }
@@ -954,7 +955,8 @@ set_channel(int x, int y, int channel, float value) {
     break;
 
   default:
-    nassertv(false);
+    nassert_raise("unexpected channel count");
+    break;
   }
 }
 
@@ -2126,7 +2128,7 @@ setup_encoding() {
       break;
 
     default:
-      nassertv(false);
+      nassert_raise("invalid color space");
       break;
     }
   } else {
@@ -2153,7 +2155,7 @@ setup_encoding() {
       break;
 
     default:
-      nassertv(false);
+      nassert_raise("invalid color space");
       break;
     }
   }

+ 2 - 1
panda/src/pnmimagetypes/pnmFileTypePfm.cxx

@@ -283,7 +283,8 @@ write_pfm(const PfmFile &pfm) {
     break;
 
   default:
-    nassertr(false, false);
+    nassert_raise("unexpected channel count");
+    return false;
   }
   (*_file) << pfm.get_x_size() << " " << pfm.get_y_size() << "\n";
 

+ 2 - 1
panda/src/pnmimagetypes/pnmFileTypeSGIWriter.cxx

@@ -135,7 +135,8 @@ write_header() {
     break;
 
   default:
-    nassertr(false, false);
+    nassert_raise("unexpected channel count");
+    return false;
   }
 
   // For some reason, we have problems with SGI image files whose pixmax value

+ 1 - 1
panda/src/putil/sparseArray.I

@@ -93,7 +93,7 @@ has_max_num_bits() {
  */
 INLINE int SparseArray::
 get_max_num_bits() {
-  nassertr(false, 0);
+  nassert_raise("SparseArray has no maximum bit count");
   return 0;
 }
 

+ 1 - 1
panda/src/text/textAssembler.cxx

@@ -2536,7 +2536,7 @@ get_primitive(TypeHandle prim_type) {
     return _points;
   }
 
-  nassertr(false, nullptr);
+  nassert_raise("unexpected primitive type");
   return nullptr;
 }
 

+ 2 - 1
panda/src/vision/webcamVideoCursorV4L.cxx

@@ -487,7 +487,8 @@ fetch_buffer() {
       block[i + 2] = ex;
     }
 #else
-    nassertr(false /* Not compiled with JPEG support*/, nullptr);
+    nassert_raise("JPEG support not compiled-in");
+    return nullptr;
 #endif
     break;
   }

+ 1 - 1
pandatool/src/assimp/pandaIOSystem.cxx

@@ -79,7 +79,7 @@ Open(const char *file, const char *mode) {
     return new PandaIOStream(*stream);
 
   } else {
-    nassertr(false, nullptr); // Not implemented on purpose.
+    nassert_raise("write mode not implemented");
     return nullptr;
   }
 }

+ 1 - 1
pandatool/src/eggcharbase/eggBackPointer.cxx

@@ -40,7 +40,7 @@ get_frame_rate() const {
 void EggBackPointer::
 extend_to(int num_frames) {
   // Whoops, can't extend this kind of table!
-  nassertv(false);
+  nassert_raise("can't extend this kind of table");
 }
 
 /**