From 9c086c503a3b4693f99424fe600f6f64a91f3d63 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 1 Apr 2018 18:29:57 +0300 Subject: [PATCH] Fix NPE in GetExternalFilesDir. Correct return value in gamepad code --- src/in/celest/xash3d/XashActivity.java | 4 +++- src/su/xash/fwgslib/FWGSLib.java | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/in/celest/xash3d/XashActivity.java b/src/in/celest/xash3d/XashActivity.java index 92d6eb37..1379bae4 100644 --- a/src/in/celest/xash3d/XashActivity.java +++ b/src/in/celest/xash3d/XashActivity.java @@ -691,13 +691,15 @@ public class XashActivity extends Activity { if( action == KeyEvent.ACTION_DOWN ) { nativeHat( id, hat, val, true ); + return true; } else if( action == KeyEvent.ACTION_UP ) { nativeHat( id, hat, val, false ); + return true; } - return true; + return false; } // Engine will bind these to AUX${val} virtual keys diff --git a/src/su/xash/fwgslib/FWGSLib.java b/src/su/xash/fwgslib/FWGSLib.java index c1a41ee8..caeb1617 100644 --- a/src/su/xash/fwgslib/FWGSLib.java +++ b/src/su/xash/fwgslib/FWGSLib.java @@ -115,6 +115,11 @@ public class FWGSLib { File f = ctx.getExternalFilesDir( null ); + if( f == null ) + { + f = new File( getDefaultXashPath() ); + } + f.mkdirs(); return f.getAbsolutePath();