Kaynağa Gözat

Improve exception handling for downloadBytes

luboslenco 3 yıl önce
ebeveyn
işleme
72a302270c
1 değiştirilmiş dosya ile 4 ekleme ve 4 silme
  1. 4 4
      Sources/arm/sys/File.hx

+ 4 - 4
Sources/arm/sys/File.hx

@@ -88,12 +88,12 @@ class File {
 	public static function downloadBytes(url: String, done: Bytes->Void) {
 		var save = (Path.isProtected() ? Krom.savePath() : Path.data() + Path.sep) + "download.bin";
 		File.download(url, save, function() {
+			var bytes: Bytes = null;
 			try {
-				done(Bytes.ofData(Krom.loadBlob(save)));
-			}
-			catch (e: Dynamic) {
-				done(null);
+				bytes = Bytes.ofData(Krom.loadBlob(save));
 			}
+			catch (e: Dynamic) {}
+			done(bytes);
 		});
 	}