avoid null pointer dereference

This commit is contained in:
Axel Kohlmeyer
2022-09-22 13:21:54 -04:00
parent 24fd02725c
commit 3c5e446165

View File

@ -779,9 +779,11 @@ std::string Atom::get_style()
std::string retval = atom_style;
if (retval == "hybrid") {
auto avec_hybrid = dynamic_cast<AtomVecHybrid *>(avec);
for (int i = 0; i < avec_hybrid->nstyles; i++) {
retval += ' ';
retval += avec_hybrid->keywords[i];
if (avec_hybrid) {
for (int i = 0; i < avec_hybrid->nstyles; i++) {
retval += ' ';
retval += avec_hybrid->keywords[i];
}
}
}
return retval;