Skip to content

Commit 2184351

Browse files
committed
fix2
1 parent 5a901f2 commit 2184351

File tree

1 file changed

+8
-4
lines changed
  • SuperiorPlugin/src/main/java/com/scrappers/superiorExtendedEngine/menuStates/uiPager

1 file changed

+8
-4
lines changed

SuperiorPlugin/src/main/java/com/scrappers/superiorExtendedEngine/menuStates/uiPager/UiPager.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -190,20 +190,24 @@ public void forEachUiState(UiStatesLooper.Modifiable.Looper uiStatesLooper){
190190
*/
191191
public String[] search(String[] searchList, String[] searchKeyWords, ActionInjector injector) throws Exception {
192192
synchronized(this) {
193-
final String[] resultList = new String[searchList.length];
193+
final String[][] resultList = {new String[0]};
194194
return Executors.callable(() -> {
195195
for (int pos = 0; pos < searchList.length; pos++) {
196196
for (String keyword : searchKeyWords) {
197197
if (searchList[pos].replaceAll(" ","").trim().toLowerCase().contains(keyword.replaceAll(" ","").trim().toLowerCase())) {
198-
resultList[pos] = searchList[pos];
198+
//dynamic array conception
199+
if(pos > resultList[0].length){
200+
resultList[0] = Arrays.copyOf(resultList[0], resultList[0].length+1);
201+
}
202+
resultList[0][pos] = searchList[pos];
199203
if(injector != null){
200204
injector.execute(getChildUiStateByIndex(pos), pos);
201205
}
202206
break;
203207
}
204208
}
205209
}
206-
}, resultList).call();
210+
}, resultList[0]).call();
207211
}
208212
}
209213

@@ -237,7 +241,7 @@ public void revertSearchEngine(@Nullable ActionInjector actionInjector) throws E
237241
public String[] sort(String[] list, int sortAlgorithm) throws Exception {
238242
synchronized(this) {
239243
//to apply the sort change as an external final change on a list copy (warning : ->Internal List change(positions or items count or items values) = Malicious Activity
240-
final String[] copy = list;
244+
final String[] copy = Arrays.copyOf(list, list.length);
241245
return Executors.callable(() -> {
242246
String tempPointer = "";
243247
//main String List looping

0 commit comments

Comments
 (0)