[commit] r2712 - in trunk: Doc GME/Mga

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Fri Nov 10 16:01:51 CST 2017


Author: ksmyth
Date: Fri Nov 10 16:01:50 2017
New Revision: 2712

Log:
IMgaProject.GetObjectByID: fail when there is not object with the supplied ID

Modified:
   trunk/Doc/README_in.txt
   trunk/GME/Mga/MgaProject.cpp

Modified: trunk/Doc/README_in.txt
==============================================================================
--- trunk/Doc/README_in.txt	Fri Nov 10 16:01:46 2017	(r2711)
+++ trunk/Doc/README_in.txt	Fri Nov 10 16:01:50 2017	(r2712)
@@ -29,6 +29,7 @@
 ----------------------------------
   - Binary compatibility with 11.12.2
   - Fix crash under GME x64 and high memory usage
+  - IMgaProject.ObjectByID fail when there is not object with the supplied ID
 
 Release Notes of Release 17.10.13
 ----------------------------------

Modified: trunk/GME/Mga/MgaProject.cpp
==============================================================================
--- trunk/GME/Mga/MgaProject.cpp	Fri Nov 10 16:01:46 2017	(r2711)
+++ trunk/GME/Mga/MgaProject.cpp	Fri Nov 10 16:01:50 2017	(r2712)
@@ -780,7 +780,31 @@
 		CoreObj obj;
 		COMTHROW(dataproject->get_Object(mm,ss,&obj.ComPtr()));
 		if (obj)
-			ObjForCore(obj)->getinterface(pVal);
+		{
+			IMgaObject *ret;
+			ObjForCore(obj)->getinterface(&ret);
+			if (ret == NULL)
+			{
+				// this should never happen
+				ASSERT(false);
+				obj->Delete();
+				COMTHROW(E_NOTFOUND);
+			}
+			// get_Object will create an object if the ID does not exist
+			// need to read from core storage to test if it exists
+			_bstr_t name;
+			HRESULT hr = ret->get_Name(name.GetAddress());
+			if (SUCCEEDED(hr)) {
+				*pVal = ret;
+				return S_OK;
+			}
+			else
+			{
+				obj->Delete();
+				ret->Release();
+				COMTHROW(hr);
+			}
+		}
 		else
 			COMTHROW(E_MGA_BAD_ID);
     } COMCATCH(;);


More information about the gme-commit mailing list