Print Page | Close Window

Missing pointer test

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=20231
Printed Date: 14 June 2025 at 10:32pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Missing pointer test
Posted By: Sergio
Subject: Missing pointer test
Date Posted: 17 October 2012 at 10:39am
Hello,

We are having a crash there :

CXTPReportColumn* CXTPReportColumns::Find(int nItemIndex) const
{
        for (int nColumn = 0; nColumn < GetCount(); nColumn++)
        {
                CXTPReportColumn* pColumn = GetAt(nColumn);
                if (pColumn->GetItemIndex() == nItemIndex)
                        return pColumn;
        }
        return NULL;
}

We are having a case where the method GetAt(...) returns NULL, and the variable pColumn is NULL. You access directly to a member method of that variable without checking for its validity.

Our temporary workaround is to code our own Find method.

Please fix that for the next release, as we use the Find in many other parts of the code.

Thank you.



-------------
Sergio



Replies:
Posted By: mgampi
Date Posted: 05 November 2012 at 5:26pm
I ran into the same crash, but in my case it's not reproduceable all the time!



-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net