[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-dev] Re: [XaraXtreme-commits] Commit Complete

subversion@xxxxxxxxxxxxxx wrote:
Commit by  : alex
Repository : xara
Revision   : 1466
Date       : Tue Jul 18 17:24:30 BST 2006

Changed paths:
   M /Trunk/XaraLX/wxOil/oilprefs.cpp

If a string preference is not present in the preferences file, do not overwrite the default value.

Index: Trunk/XaraLX/wxOil/oilprefs.cpp
--- Trunk/XaraLX/wxOil/oilprefs.cpp	(revision 1465)
+++ Trunk/XaraLX/wxOil/oilprefs.cpp	(revision 1466)
@@ -328,11 +328,13 @@
 			// Just get the string - need to ask for the address of the String's
 			// text buffer so we can pass it to the SDK profile API.
-				wxString str;
-				wxConfig::Read(strKey, &str);
+			wxString str;
+			if (wxConfig::Read(strKey, &str))
+			{
 				*(pData.pString) = (LPCTSTR)str;
 //				*(pData.pString) = String_256(str);	// use this form when StringBase derived classes support direct conversion
+			}

Did you do this for a reason? I certainly have written code that is reliant on the string being empty after the call to this function (and there is lots more that is also reliant on this fact). My code will still work because the string is always empty before I make the call, but I don't know for certain about of instances.