From 2fbdb121e407e76f4c9cf4aeaec0aa3c0a9cc4f2 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Thu, 4 Feb 2021 16:41:50 +0300 Subject: [PATCH] Fix npe --- .../net/osmand/plus/voice/JSMediaCommandPlayerImpl.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/voice/JSMediaCommandPlayerImpl.java b/OsmAnd/src/net/osmand/plus/voice/JSMediaCommandPlayerImpl.java index 80fd5381ab..fd9caafe2c 100644 --- a/OsmAnd/src/net/osmand/plus/voice/JSMediaCommandPlayerImpl.java +++ b/OsmAnd/src/net/osmand/plus/voice/JSMediaCommandPlayerImpl.java @@ -90,9 +90,12 @@ public class JSMediaCommandPlayerImpl extends MediaCommandPlayerImpl { if (voiceDir.getName().contains("tts")) { return false; } - for (File f : voiceDir.listFiles()) { - if (f.getName().endsWith(IndexConstants.TTSVOICE_INDEX_EXT_JS)) { - return true; + File[] files = voiceDir.listFiles(); + if (files != null) { + for (File f : files) { + if (f.getName().endsWith(IndexConstants.TTSVOICE_INDEX_EXT_JS)) { + return true; + } } } return false;