creator/engine/src/creator_note.cpp
changeset 52 36d60d12b4af
parent 51 b048e15729d6
--- a/creator/engine/src/creator_note.cpp	Fri Sep 03 17:11:21 2010 +0300
+++ b/creator/engine/src/creator_note.cpp	Fri Sep 17 14:22:55 2010 +0300
@@ -114,21 +114,20 @@
     delete iParameters;
     iParameters = NULL;
     
-    CNotepadParameters* parameters = aParameters;
-    
     // random data needed if no predefined data available
-    if (!parameters)
+    if (!aParameters)
         {
         iParameters = new(ELeave) CNotepadParameters;
-        parameters = iParameters;
-        parameters->iNoteText->Des() = iEngine->RandomString(CCreatorEngine::EMessageText);
         }
+    else
+        {
+        iParameters = aParameters;
+        }
+
+    TPtr noteTextPtr = iParameters->iNoteText->Des();
+    noteTextPtr.Copy( iEngine->RandomString(CCreatorEngine::EMessageText).Left( noteTextPtr.MaxLength() ) );
     
-    TInt err = KErrNone;
-
-    iNotepadWrapper->CreateNoteL(parameters->iNoteText->Des());
-    
-    return err;
+    return iNotepadWrapper->CreateNoteL( noteTextPtr );
     }
 
 //----------------------------------------------------------------------------