mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-09-02 07:05:09 +00:00
Fixes some potential null pointer exceptions reported by Coverity
This commit is contained in:
@@ -328,6 +328,8 @@ public class LanLinkProvider extends BaseLinkProvider {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Log.e("KDE/LanLinkProvider","Failed to create DatagramSocket");
|
Log.e("KDE/LanLinkProvider","Failed to create DatagramSocket");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bytes != null) {
|
||||||
//Log.e("KDE/LanLinkProvider","Sending packet to "+iplist.size()+" ips");
|
//Log.e("KDE/LanLinkProvider","Sending packet to "+iplist.size()+" ips");
|
||||||
for (String ipstr : iplist) {
|
for (String ipstr : iplist) {
|
||||||
try {
|
try {
|
||||||
@@ -340,6 +342,8 @@ public class LanLinkProvider extends BaseLinkProvider {
|
|||||||
Log.e("KDE/LanLinkProvider", "Sending udp identity package failed. Invalid address? (" + ipstr + ")");
|
Log.e("KDE/LanLinkProvider", "Sending udp identity package failed. Invalid address? (" + ipstr + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
socket.close();
|
socket.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -144,6 +144,7 @@ public class ShareActivity extends ActionBarActivity {
|
|||||||
Device device = devicesList.get(i-1); //NOTE: -1 because of the title!
|
Device device = devicesList.get(i-1); //NOTE: -1 because of the title!
|
||||||
|
|
||||||
Bundle extras = intent.getExtras();
|
Bundle extras = intent.getExtras();
|
||||||
|
if (extras != null) {
|
||||||
if (extras.containsKey(Intent.EXTRA_STREAM)) {
|
if (extras.containsKey(Intent.EXTRA_STREAM)) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -191,8 +192,7 @@ public class ShareActivity extends ActionBarActivity {
|
|||||||
}
|
}
|
||||||
device.sendPackage(np);
|
device.sendPackage(np);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
@@ -108,9 +108,12 @@ public class CustomDevicesActivity extends ListActivity {
|
|||||||
InputMethodManager inputManager = (InputMethodManager)
|
InputMethodManager inputManager = (InputMethodManager)
|
||||||
getSystemService(Context.INPUT_METHOD_SERVICE);
|
getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
|
||||||
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
|
View focus = getCurrentFocus();
|
||||||
|
if (focus != null) {
|
||||||
|
inputManager.hideSoftInputFromWindow(focus.getWindowToken(),
|
||||||
InputMethodManager.HIDE_NOT_ALWAYS);
|
InputMethodManager.HIDE_NOT_ALWAYS);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void saveList() {
|
void saveList() {
|
||||||
// add entry to list and save to preferences (unless empty)
|
// add entry to list and save to preferences (unless empty)
|
||||||
|
@@ -46,11 +46,13 @@ public class SmallEntryItem implements ListAdapter.Item {
|
|||||||
View v = layoutInflater.inflate(android.R.layout.simple_list_item_1, null);
|
View v = layoutInflater.inflate(android.R.layout.simple_list_item_1, null);
|
||||||
|
|
||||||
TextView titleView = (TextView)v.findViewById(android.R.id.text1);
|
TextView titleView = (TextView)v.findViewById(android.R.id.text1);
|
||||||
if (titleView != null) titleView.setText(title);
|
if (titleView != null) {
|
||||||
|
titleView.setText(title);
|
||||||
if (clickListener != null) {
|
if (clickListener != null) {
|
||||||
titleView.setOnClickListener(clickListener);
|
titleView.setOnClickListener(clickListener);
|
||||||
v.setBackgroundDrawable(layoutInflater.getContext().getResources().getDrawable(R.drawable.abc_list_selector_holo_dark));
|
v.setBackgroundDrawable(layoutInflater.getContext().getResources().getDrawable(R.drawable.abc_list_selector_holo_dark));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user