OSDN Git Service

yFrogのNullRef対応
authorkiri_feather <kiri_feather@users.sourceforge.jp>
Mon, 27 Jun 2011 16:52:43 +0000 (01:52 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Sat, 18 Feb 2012 14:19:44 +0000 (23:19 +0900)
Tween/Connection/yfrog.vb

index 7a71bab..01ee3fe 100644 (file)
@@ -56,6 +56,7 @@ Public Class yfrog
 
     Public Function Upload(ByRef filePath As String,
                ByRef message As String) As String Implements IMultimediaShareService.Upload
+        If String.IsNullOrEmpty(filePath) Then Return "Err:File isn't exists."
         'FileInfo作成
         Dim mediaFile As FileInfo
         Try
@@ -63,7 +64,7 @@ Public Class yfrog
         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
@@ -87,6 +88,8 @@ Public Class yfrog
             Return "Err:" + ret.ToString
         End If
 
+        If String.IsNullOrEmpty(url) Then Return "Err:Upload failed."
+        If message Is Nothing Then message = ""
         'アップロードまでは成功
         filePath = ""
         'Twitterへの投稿