mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 09:01:57 -05:00
Throw more helpful 'FileNotFoundException' instead of 'System.ArgumentException: Parameter is not valid' for missing images.
This commit is contained in:
parent
b1690d75ab
commit
7b3794dfbc
2 changed files with 5 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
|
||||
|
@ -18,6 +19,9 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||
public abstract bool Texturing { set; }
|
||||
|
||||
public virtual int LoadTexture( string path ) {
|
||||
if( !File.Exists( path ) ) {
|
||||
throw new FileNotFoundException( path + " not found" );
|
||||
}
|
||||
using( Bitmap bmp = new Bitmap( path ) ) {
|
||||
return LoadTexture( bmp );
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ namespace ClassicalSharp {
|
|||
Exception ex = (Exception)e.ExceptionObject;
|
||||
MessageBox.Show(
|
||||
"Oh dear, ClassicalSharp crashed. Crash cause: " + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
ex.GetType().FullName + ": " + ex.Message + Environment.NewLine +
|
||||
ex.StackTrace + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
|
|
Loading…
Reference in a new issue