From bddea8821e74052e30da6957cf7eeadafe7b830d Mon Sep 17 00:00:00 2001 From: Daniel Bergman Date: Fri, 24 Oct 2025 15:10:06 -0400 Subject: [PATCH] handle an empty colormap element for substrate in svg --- modules/PhysiCell_pathology.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/PhysiCell_pathology.cpp b/modules/PhysiCell_pathology.cpp index 209c39349..eef368b1e 100644 --- a/modules/PhysiCell_pathology.cpp +++ b/modules/PhysiCell_pathology.cpp @@ -789,6 +789,14 @@ void setup_svg_substrate_colormap(std::vector &colormap) std::string map_name = PhysiCell_settings.svg_substrate_colormap; int name_length = map_name.size(); bool is_reversed = false; + if (name_length < 2) + { + std::cout << "WARNING: colormap name " << map_name << " is too short. Using default 'YlOrRd' colormap." << std::endl + << " Check your save//SVG//plot_substrate//colormap element in your configuration file." << std::endl; + map_name = "YlOrRd"; + name_length = map_name.size(); + PhysiCell_settings.svg_substrate_colormap = map_name; + } if (map_name.substr(name_length-2,2)=="_r") { map_name = map_name.substr(0,name_length-2);