omads/omadsextensions/adapters/notes/src/NSmlNotepadDataStore.cpp
changeset 64 a62b67d1f67c
parent 54 13ecdfc9a581
--- a/omads/omadsextensions/adapters/notes/src/NSmlNotepadDataStore.cpp	Tue Sep 28 18:46:16 2010 +0530
+++ b/omads/omadsextensions/adapters/notes/src/NSmlNotepadDataStore.cpp	Tue Oct 12 17:42:13 2010 +0530
@@ -1130,20 +1130,24 @@
             {
             _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore:: FetchItemL():  begin");
             
-            HBufC8* buf = ConvertNoteToSyncItemL(*note);
-            CleanupStack::PushL(buf);
-            aItem.Reset();
-            // Write the buffer to the passed writeStream (aItem)
-            TBufBuf bufBuf;
-            bufBuf.Set(aItem, 0, TBufBuf::EWrite);
-            RWriteStream writeStream( &bufBuf);
-            writeStream.PushL();
-            writeStream.WriteL(buf->Des().Ptr(), buf->Des().Length());
-            writeStream.CommitL();
-            CleanupStack::PopAndDestroy(1);//writeStream
-            CleanupStack::PopAndDestroy(buf);//buf
-            _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::FetchItemL(): end");
-            }
+            HBufC8* buf = NULL;
+            TRAP(err, buf = ConvertNoteToSyncItemL(*note));
+            if(err == KErrNone)
+                {
+                CleanupStack::PushL(buf);
+                aItem.Reset();
+                // Write the buffer to the passed writeStream (aItem)
+                TBufBuf bufBuf;
+                bufBuf.Set(aItem, 0, TBufBuf::EWrite);
+                RWriteStream writeStream( &bufBuf);
+                writeStream.PushL();
+                writeStream.WriteL(buf->Des().Ptr(), buf->Des().Length());
+                writeStream.CommitL();
+                CleanupStack::PopAndDestroy(1);//writeStream
+                CleanupStack::PopAndDestroy(buf);//buf
+                _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::FetchItemL(): end");
+                }     
+              }
         CleanupStack::PopAndDestroy(note); // note
         }
     else
@@ -1198,8 +1202,7 @@
     {
     if (!aNote.Content())
         {
-        HBufC8* tempHBuf = HBufC8::NewL(KNullCharLen);//room for null character
-        return tempHBuf;
+        User::Leave(KErrGeneral);
         }
     // Note: a single unicode character can be 4 bytes long in UTF8 format,
     // hence the long length for 8-bit buffer.