[Tween-svn] [1590] 画像投稿でNullref出る場合があるようなので対応

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 9月 12日 (月) 14:46:37 JST


Revision: 1590
          http://sourceforge.jp/projects/tween/svn/view?view=rev&revision=1590
Author:   kiri_feather
Date:     2011-09-12 14:46:36 +0900 (Mon, 12 Sep 2011)

Log Message:
-----------
画像投稿でNullref出る場合があるようなので対応

Modified Paths:
--------------
    trunk/Tween/Connection/Plixi.vb
    trunk/Tween/Connection/TwitPic.vb
    trunk/Tween/Connection/TwitterPhoto.vb
    trunk/Tween/Connection/imgly.vb
    trunk/Tween/Connection/yfrog.vb


-------------- next part --------------
Modified: trunk/Tween/Connection/Plixi.vb
===================================================================
--- trunk/Tween/Connection/Plixi.vb	2011-09-12 04:45:07 UTC (rev 1589)
+++ trunk/Tween/Connection/Plixi.vb	2011-09-12 05:46:36 UTC (rev 1590)
@@ -55,13 +55,15 @@
     Public Function Upload(ByRef filePath As String,
                            ByRef message As String,
                            ByVal reply_to As Long) As String Implements IMultimediaShareService.Upload
+        If String.IsNullOrEmpty(filePath) Then Return "Err:File isn't specified."
+        If String.IsNullOrEmpty(message) Then message = ""
         Dim mediaFile As FileInfo
         Try
             mediaFile = New FileInfo(filePath)
         Catch ex As NotSupportedException
             Return "Err:" + ex.Message
         End Try
-        If Not mediaFile.Exists Then Return "Err:File isn't exists."
+        If mediaFile Is Nothing OrElse Not mediaFile.Exists Then Return "Err:File isn't exists."
 
         Dim content As String = ""
         Dim ret As HttpStatusCode
@@ -86,6 +88,7 @@
         End If
         'アップロードまでは成功
         filePath = ""
+        If String.IsNullOrEmpty(url) Then url = ""
         'Twitterへの投稿
         '投稿メッセージの再構成
         If message.Length + url.Length + 1 > 140 Then

Modified: trunk/Tween/Connection/TwitPic.vb
===================================================================
--- trunk/Tween/Connection/TwitPic.vb	2011-09-12 04:45:07 UTC (rev 1589)
+++ trunk/Tween/Connection/TwitPic.vb	2011-09-12 05:46:36 UTC (rev 1590)
@@ -68,13 +68,15 @@
     Public Function Upload(ByRef filePath As String,
                            ByRef message As String,
                            ByVal reply_to As Long) As String Implements IMultimediaShareService.Upload
+        If String.IsNullOrEmpty(filePath) Then Return "Err:File isn't specified."
+        If String.IsNullOrEmpty(message) Then message = ""
         Dim mediaFile As FileInfo
         Try
             mediaFile = New FileInfo(filePath)
         Catch ex As NotSupportedException
             Return "Err:" + ex.Message
         End Try
-        If Not mediaFile.Exists Then Return "Err:File isn't exists."
+        If mediaFile Is Nothing OrElse Not mediaFile.Exists Then Return "Err:File isn't exists."
 
         Dim content As String = ""
         Dim ret As HttpStatusCode
@@ -99,6 +101,7 @@
         End If
         'アップロードまでは成功
         filePath = ""
+        If String.IsNullOrEmpty(url) Then url = ""
         'Twitterへの投稿
         '投稿メッセージの再構成
         If message.Length + url.Length + 1 > 140 Then

Modified: trunk/Tween/Connection/TwitterPhoto.vb
===================================================================
--- trunk/Tween/Connection/TwitterPhoto.vb	2011-09-12 04:45:07 UTC (rev 1589)
+++ trunk/Tween/Connection/TwitterPhoto.vb	2011-09-12 05:46:36 UTC (rev 1590)
@@ -68,6 +68,8 @@
     Public Function Upload(ByRef filePath As String,
                            ByRef message As String,
                            ByVal reply_to As Long) As String Implements IMultimediaShareService.Upload
+        If String.IsNullOrEmpty(filePath) Then Return "Err:File isn't specified."
+        If String.IsNullOrEmpty(message) Then message = ""
         Dim mediaFile As FileInfo
         Try
             mediaFile = New FileInfo(filePath)

Modified: trunk/Tween/Connection/imgly.vb
===================================================================
--- trunk/Tween/Connection/imgly.vb	2011-09-12 04:45:07 UTC (rev 1589)
+++ trunk/Tween/Connection/imgly.vb	2011-09-12 05:46:36 UTC (rev 1590)
@@ -54,13 +54,15 @@
     Public Function Upload(ByRef filePath As String,
                            ByRef message As String,
                            ByVal reply_to As Long) As String Implements IMultimediaShareService.Upload
+        If String.IsNullOrEmpty(filePath) Then Return "Err:File isn't specified."
+        If String.IsNullOrEmpty(message) Then message = ""
         Dim mediaFile As FileInfo
         Try
             mediaFile = New FileInfo(filePath)
         Catch ex As NotSupportedException
             Return "Err:" + ex.Message
         End Try
-        If Not mediaFile.Exists Then Return "Err:File isn't exists."
+        If mediaFile Is Nothing OrElse Not mediaFile.Exists Then Return "Err:File isn't exists."
 
         Dim content As String = ""
         Dim ret As HttpStatusCode
@@ -85,6 +87,7 @@
         End If
         'アップロードまでは成功
         filePath = ""
+        If String.IsNullOrEmpty(url) Then url = ""
         'Twitterへの投稿
         '投稿メッセージの再構成
         If message.Length + url.Length + 1 > 140 Then

Modified: trunk/Tween/Connection/yfrog.vb
===================================================================
--- trunk/Tween/Connection/yfrog.vb	2011-09-12 04:45:07 UTC (rev 1589)
+++ trunk/Tween/Connection/yfrog.vb	2011-09-12 05:46:36 UTC (rev 1590)
@@ -56,6 +56,7 @@
                            ByRef message As String,
                            ByVal reply_to As Long) As String Implements IMultimediaShareService.Upload
         If String.IsNullOrEmpty(filePath) Then Return "Err:File isn't exists."
+        If String.IsNullOrEmpty(message) Then message = ""
         'FileInfo作成
         Dim mediaFile As FileInfo
         Try
@@ -89,8 +90,7 @@
             Return "Err:" + ret.ToString
         End If
 
-        If String.IsNullOrEmpty(url) Then Return "Err:Upload failed."
-        If message Is Nothing Then message = ""
+        If String.IsNullOrEmpty(url) Then url = ""
         'アップロードまでは成功
         filePath = ""
         'Twitterへの投稿



Tween-svn メーリングリストの案内
Back to archive index