Skip to content

Commit

Permalink
Merge pull request #1793 from ghutchis/fix-vdw-crash
Browse files Browse the repository at this point in the history
Fix a potential crash in the new translucent VdW & licorice code
  • Loading branch information
ghutchis authored Nov 18, 2024
2 parents 27d5bb7 + bf1229a commit abcb778
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion avogadro/qtplugins/licorice/licorice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ void Licorice::process(const Molecule& molecule, Rendering::GroupNode& node)
}
Vector3ub color = atom.color();

opacity = m_layerManager.getSetting<LayerLicorice>(i)->opacity;
auto* interface =
m_layerManager.getSetting<LayerLicorice>(m_layerManager.getLayerID(i));
opacity = interface->opacity;
if (opacity < 1.0f) {
translucentSpheres->addSphere(atom.position3d().cast<float>(), color,
radius, i);
Expand Down
4 changes: 3 additions & 1 deletion avogadro/qtplugins/vanderwaals/vanderwaals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ void VanDerWaals::process(const QtGui::Molecule& molecule,

Vector3ub color = atom.color();
auto radius = static_cast<float>(Elements::radiusVDW(atomicNumber));
float opacity = m_layerManager.getSetting<LayerVdW>(i)->opacity;
auto* interface =
m_layerManager.getSetting<LayerVdW>(m_layerManager.getLayerID(i));
float opacity = interface->opacity;
if (opacity < 1.0f) {
translucentSpheres->addSphere(atom.position3d().cast<float>(), color,
radius, i);
Expand Down

0 comments on commit abcb778

Please sign in to comment.