mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 20:00:46 +00:00
Catch class cast exceptions in EssentialsConf
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1491 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
parent
410f174b23
commit
c7208b9b42
1 changed files with 18 additions and 2 deletions
|
@ -186,7 +186,15 @@ public class EssentialsConf extends Configuration
|
|||
|
||||
public long getLong(String path, long def)
|
||||
{
|
||||
Number num = (Number)getProperty(path);
|
||||
Number num;
|
||||
try
|
||||
{
|
||||
num = (Number)getProperty(path);
|
||||
}
|
||||
catch(ClassCastException ex)
|
||||
{
|
||||
return def;
|
||||
}
|
||||
if (num == null)
|
||||
{
|
||||
return def;
|
||||
|
@ -197,7 +205,15 @@ public class EssentialsConf extends Configuration
|
|||
@Override
|
||||
public double getDouble(String path, double def)
|
||||
{
|
||||
Number num = (Number)getProperty(path);
|
||||
Number num;
|
||||
try
|
||||
{
|
||||
num = (Number)getProperty(path);
|
||||
}
|
||||
catch(ClassCastException ex)
|
||||
{
|
||||
return def;
|
||||
}
|
||||
if (num == null)
|
||||
{
|
||||
return def;
|
||||
|
|
Loading…
Reference in a new issue