[app] Fix crash when module not found (#744)
This commit is contained in:
parent
32329ac7d3
commit
31e4254681
|
|
@ -66,6 +66,9 @@ public class AppListFragment extends BaseFragment {
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
binding = FragmentAppListBinding.inflate(getLayoutInflater(), container, false);
|
binding = FragmentAppListBinding.inflate(getLayoutInflater(), container, false);
|
||||||
|
if (module == null) {
|
||||||
|
return binding.getRoot();
|
||||||
|
}
|
||||||
binding.appBar.setRaised(true);
|
binding.appBar.setRaised(true);
|
||||||
String title;
|
String title;
|
||||||
if (module.userId != 0) {
|
if (module.userId != 0) {
|
||||||
|
|
@ -99,7 +102,7 @@ public class AppListFragment extends BaseFragment {
|
||||||
|
|
||||||
module = ModuleUtil.getInstance().getModule(modulePackageName, moduleUserId);
|
module = ModuleUtil.getInstance().getModule(modulePackageName, moduleUserId);
|
||||||
if (module == null) {
|
if (module == null) {
|
||||||
getNavController().navigateUp();
|
getNavController().navigate(R.id.action_modules_fragment);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.navigation.NavController;
|
import androidx.navigation.NavController;
|
||||||
import androidx.navigation.Navigation;
|
import androidx.navigation.Navigation;
|
||||||
|
import androidx.navigation.fragment.NavHostFragment;
|
||||||
|
|
||||||
import org.lsposed.manager.R;
|
import org.lsposed.manager.R;
|
||||||
|
|
||||||
|
|
@ -36,7 +37,7 @@ public class BaseFragment extends Fragment {
|
||||||
public NavController getNavController() {
|
public NavController getNavController() {
|
||||||
View view = getView();
|
View view = getView();
|
||||||
if (view == null) {
|
if (view == null) {
|
||||||
return null;
|
return NavHostFragment.findNavController(this);
|
||||||
}
|
}
|
||||||
View tabletFragmentContainer = view.findViewById(R.id.tablet_nav_container);
|
View tabletFragmentContainer = view.findViewById(R.id.tablet_nav_container);
|
||||||
if (tabletFragmentContainer != null) {
|
if (tabletFragmentContainer != null) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue