Skip to content

Commit

Permalink
Enhanced check for invalid NULL parameter.
Browse files Browse the repository at this point in the history
Even if the passed value should never be NULL, such a check does not
do any harm.
  • Loading branch information
jriesmeier committed Jan 11, 2025
1 parent f192e0c commit e9c0243
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dcmimgle/include/dcmtk/dcmimgle/dimoipxt.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (C) 1996-2021, OFFIS e.V.
* Copyright (C) 1996-2025, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
Expand Down Expand Up @@ -55,16 +55,16 @@ class DiMonoInputPixelTemplate
DiMonoModality *modality)
: DiMonoPixelTemplate<T3>(pixel, modality)
{
if ((pixel != NULL) && (this->Count > 0))
if ((pixel != NULL) && (this->Modality != NULL) && (this->Count > 0))
{
// check whether to apply any modality transform
if ((this->Modality != NULL) && this->Modality->hasLookupTable() && (bitsof(T1) <= MAX_TABLE_ENTRY_SIZE))
if (this->Modality->hasLookupTable() && (bitsof(T1) <= MAX_TABLE_ENTRY_SIZE))
{
modlut(pixel);
// ignore modality LUT min/max values since the image does not necessarily have to use all LUT entries
this->determineMinMax();
}
else if ((this->Modality != NULL) && this->Modality->hasRescaling())
else if (this->Modality->hasRescaling())
{
rescale(pixel, this->Modality->getRescaleSlope(), this->Modality->getRescaleIntercept());
this->determineMinMax(OFstatic_cast(T3, this->Modality->getMinValue()), OFstatic_cast(T3, this->Modality->getMaxValue()));
Expand Down

0 comments on commit e9c0243

Please sign in to comment.