Fix crash when tapping the placeholder

This commit is contained in:
Cameron Gutman 2014-07-04 11:31:03 -07:00
parent 3176ee72fe
commit c50ec21f39

View File

@ -94,7 +94,11 @@ public class PcView extends Activity {
public void onItemClick(AdapterView<?> arg0, View arg1, int pos, public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
long id) { long id) {
ComputerObject computer = (ComputerObject) pcListAdapter.getItem(pos); ComputerObject computer = (ComputerObject) pcListAdapter.getItem(pos);
if (computer.details.reachability == ComputerDetails.Reachability.OFFLINE) { if (computer.details == null) {
// Placeholder item; no context menu for it
return;
}
else if (computer.details.reachability == ComputerDetails.Reachability.OFFLINE) {
// Open the context menu if a PC is offline // Open the context menu if a PC is offline
openContextMenu(arg1); openContextMenu(arg1);
} }