mirror of
https://github.com/TeamAmaze/AmazeFileManager.git
synced 2026-10-18 13:51:20 +08:00
Add null-guards for IP address.
This commit is contained in:
@@ -320,6 +320,9 @@ public class FtpService extends Service implements Runnable {
|
||||
Enumeration<InetAddress> addresses = netinterface.getInetAddresses();
|
||||
while (addresses.hasMoreElements()) {
|
||||
InetAddress address = addresses.nextElement();
|
||||
if (address == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(address.getHostAddress().startsWith(WIFI_AP_ADDRESS_PREFIX) && isEnabledWifiHotspot(context))
|
||||
return address;
|
||||
|
||||
@@ -88,12 +88,17 @@ public class FtpNotification extends BroadcastReceiver {
|
||||
|
||||
InetAddress address = FtpService.getLocalInetAddress(context);
|
||||
|
||||
String iptext = (secureConnection ? FtpService.INITIALS_HOST_SFTP : FtpService.INITIALS_HOST_FTP)
|
||||
+ address.getHostAddress() + ":"
|
||||
+ port + "/";
|
||||
String address_text = "Address not found";
|
||||
|
||||
if (address != null) {
|
||||
address_text = (secureConnection ? FtpService.INITIALS_HOST_SFTP : FtpService.INITIALS_HOST_FTP)
|
||||
+ address.getHostAddress() + ":"
|
||||
+ port + "/";
|
||||
}
|
||||
|
||||
|
||||
NotificationCompat.Builder builder = buildNotification(context,
|
||||
R.string.ftp_notif_title, context.getString(R.string.ftp_notif_text, iptext), noStopButton);
|
||||
R.string.ftp_notif_title, context.getString(R.string.ftp_notif_text, address_text), noStopButton);
|
||||
|
||||
notificationManager.notify(NotificationConstants.FTP_ID, builder.build());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user