Skip to content

Commit 2b82c04

Browse files
authored
Merge pull request #183 from tobexyz/feat/issue179
Feat/issue179
2 parents 9147338 + a799e3d commit 2b82c04

4 files changed

Lines changed: 26 additions & 8 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Version 4.4.1
2+
- added chinese translations
3+
- allow disabling of media store filtering
4+
- minor bug fixes
5+
6+
7+

yaacc/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
4-
android:versionCode="40500"
5-
android:versionName="4.5.0-SNAPSHOT">
4+
android:versionCode="40401"
5+
android:versionName="4.4.1">
66

77
<uses-permission android:name="android.permission.INTERNET" />
88
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

yaacc/src/main/java/de/yaacc/upnp/YaaccNetworkAddressFactoryImpl.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,14 @@ public Iterator<InetAddress> getBindAddresses() {
8989
List<InetAddress> result = new ArrayList<>();
9090
if (YaaccUpnpServerService.getIfName(context) != null) {
9191
try {
92-
Enumeration<InetAddress> iter = NetworkInterface.getByName(YaaccUpnpServerService.getIfName(context)).getInetAddresses();
93-
while (iter.hasMoreElements()) {
94-
result.add(iter.nextElement());
92+
if (NetworkInterface.getByName(YaaccUpnpServerService.getIfName(context)) != null) {
93+
Enumeration<InetAddress> iter = NetworkInterface.getByName(YaaccUpnpServerService.getIfName(context)).getInetAddresses();
94+
while (iter.hasMoreElements()) {
95+
result.add(iter.nextElement());
96+
}
97+
} else {
98+
Log.d(getClass().getName(),
99+
"network interface not found by name, maybe device is offline");
95100
}
96101
} catch (
97102
SocketException se) {

yaacc/src/main/java/de/yaacc/upnp/server/YaaccUpnpServerService.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ private void cancleNotification() {
248248
*
249249
*/
250250
private void initialize() {
251+
if (getUpnpClient() == null) {
252+
setUpnpClient(new UpnpClient());
253+
}
251254
if (!getUpnpClient().isInitialized()) {
252255
getUpnpClient().initialize(getApplicationContext());
253256
watchdog = false;
@@ -264,7 +267,7 @@ public void run() {
264267
}
265268

266269
}
267-
if (getUpnpClient().isInitialized()) {
270+
if (getUpnpClient() != null && getUpnpClient().isInitialized()) {
268271
if (preferences.getBoolean(getApplicationContext().getString(R.string.settings_local_server_provider_chkbx), false)) {
269272
if (localServer == null) {
270273
localServer = createMediaServerDevice();
@@ -426,11 +429,11 @@ private void startUpnpAliveNotifications() {
426429
public void run() {
427430
Log.v(YaaccUpnpServerService.this.getClass().getName(), "Sending upnp alive notivication");
428431
SendingNotificationAlive sendingNotificationAlive;
429-
if (localServer != null) {
432+
if (localServer != null && getUpnpClient() != null) {
430433
sendingNotificationAlive = new SendingNotificationAlive(getUpnpClient().getRegistry().getUpnpService(), localServer);
431434
sendingNotificationAlive.run();
432435
}
433-
if (localRenderer != null) {
436+
if (localRenderer != null && getUpnpClient() != null) {
434437
sendingNotificationAlive = new SendingNotificationAlive(getUpnpClient().getRegistry().getUpnpService(), localRenderer);
435438
sendingNotificationAlive.run();
436439
}
@@ -448,6 +451,9 @@ public void run() {
448451
* @return the time
449452
*/
450453
private int getUpnpNotificationFrequency() {
454+
if (getUpnpClient() == null) {
455+
return -1;
456+
}
451457
return Integer.parseInt(preferences.getString(getUpnpClient().getContext().getString(R.string.settings_sending_upnp_alive_interval_key), "5000"));
452458
}
453459

0 commit comments

Comments
 (0)