Handle null in more from* methods
This commit is contained in:
@@ -58,20 +58,22 @@ class AudioBuffer {
|
||||
#end
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#if lime_console
|
||||
@:void
|
||||
private static function finalize (a:AudioBuffer):Void {
|
||||
|
||||
|
||||
a.dispose ();
|
||||
|
||||
|
||||
}
|
||||
#end
|
||||
|
||||
|
||||
public static function fromBytes (bytes:Bytes):AudioBuffer {
|
||||
|
||||
if (bytes == null) return null;
|
||||
|
||||
#if lime_console
|
||||
|
||||
lime.Lib.notImplemented ("AudioBuffer.fromBytes");
|
||||
@@ -100,6 +102,8 @@ class AudioBuffer {
|
||||
|
||||
public static function fromFile (path:String):AudioBuffer {
|
||||
|
||||
if (path == null) return null;
|
||||
|
||||
#if lime_console
|
||||
|
||||
var mode = StringTools.endsWith(path, ".wav") ? FMODMode.LOOP_OFF : FMODMode.LOOP_NORMAL;
|
||||
|
||||
@@ -513,6 +513,7 @@ class Image {
|
||||
|
||||
public static function fromFile (path:String, onload:Image -> Void = null, onerror:Void -> Void = null):Image {
|
||||
|
||||
if (image == null) return null;
|
||||
var image = new Image ();
|
||||
image.__fromFile (path, onload, onerror);
|
||||
return image;
|
||||
|
||||
@@ -83,6 +83,8 @@ class Font {
|
||||
|
||||
public static function fromBytes (bytes:Bytes):Font {
|
||||
|
||||
if (bytes == null) return null;
|
||||
|
||||
var font = new Font ();
|
||||
font.__fromBytes (bytes);
|
||||
|
||||
@@ -97,6 +99,8 @@ class Font {
|
||||
|
||||
public static function fromFile (path:String):Font {
|
||||
|
||||
if (path == null) return null;
|
||||
|
||||
var font = new Font ();
|
||||
font.__fromFile (path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user