Changeset ad0929


Ignore:
Timestamp:
Mar 4, 2024, 9:34:12 PM (20 months ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Candidate_v1.7.0, stable
Children:
9782e20
Parents:
02f14d
Message:

FIX: BondGraph::GetBondLength() accessed off by one.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Graph/BondGraph.cpp

    r02f14d rad0929  
    125125    int secondZ) const
    126126{
     127  int firstIndex = firstZ-1;
     128  int secondIndex = secondZ-1;
    127129  double return_length;
    128   if ((firstZ < 0) || (firstZ >= (int)BondLengthMatrix->Matrix[0].size()))
     130  if ((firstIndex < 0) || (firstIndex >= (int)BondLengthMatrix->Matrix[0].size()))
    129131    return -1.;
    130   if ((secondZ < 0) || (secondZ >= (int)BondLengthMatrix->Matrix[0][firstZ].size()))
     132  if ((secondIndex < 0) || (secondIndex >= (int)BondLengthMatrix->Matrix[0][firstIndex].size()))
    131133    return -1.;
    132134  if (BondLengthMatrix == NULL) {
    133135    return_length = -1.;
    134136  } else {
    135     return_length = BondLengthMatrix->Matrix[0][firstZ][secondZ];
     137    return_length = BondLengthMatrix->Matrix[0][firstIndex][secondIndex];
    136138  }
    137139  LOG(4, "INFO: Request for length between " << firstZ << " and "
Note: See TracChangeset for help on using the changeset viewer.