Skip to content

Commit 01a65c7

Browse files
authored
Merge pull request #393 from drbergman/safer-substrate-colormap-read
handle an empty colormap element for substrate in svg
2 parents 3c16903 + bddea88 commit 01a65c7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

modules/PhysiCell_pathology.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,14 @@ void setup_svg_substrate_colormap(std::vector<std::string> &colormap)
789789
std::string map_name = PhysiCell_settings.svg_substrate_colormap;
790790
int name_length = map_name.size();
791791
bool is_reversed = false;
792+
if (name_length < 2)
793+
{
794+
std::cout << "WARNING: colormap name " << map_name << " is too short. Using default 'YlOrRd' colormap." << std::endl
795+
<< " Check your save//SVG//plot_substrate//colormap element in your configuration file." << std::endl;
796+
map_name = "YlOrRd";
797+
name_length = map_name.size();
798+
PhysiCell_settings.svg_substrate_colormap = map_name;
799+
}
792800
if (map_name.substr(name_length-2,2)=="_r")
793801
{
794802
map_name = map_name.substr(0,name_length-2);

0 commit comments

Comments
 (0)