code: public static Bundle arguments(Fragment frag) {
          Bundle args = frag.getArguments();
          if (args == null) {
              if (!frag.isAdded()) {
                  args = new Bundle();
                  try {
                      frag.setArguments(args);
                  } catch (IllegalStateException e) { // "attached" but not yet "added"
                      args = EMPTY;
                  }
              } else {
                  args = EMPTY;
              }
          }
          return args;
      }
docs: Get the arguments for the Fragment. If the Fragment doesn't have arguments and it isn't
  attached to an Activity, a new Bundle will be set as its arguments. Otherwise an empty (and
  immutable) Bundle will be returned.