From 49406f17d8878eee79315f818f7f389e2adb43bc Mon Sep 17 00:00:00 2001 From: bajinsheng <43855029@qq.com> Date: Fri, 16 Dec 2022 18:05:36 +0800 Subject: [PATCH] fix no table selected bug --- src/sqlancer/common/schema/AbstractSchema.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sqlancer/common/schema/AbstractSchema.java b/src/sqlancer/common/schema/AbstractSchema.java index 84a854f72..03e543a09 100644 --- a/src/sqlancer/common/schema/AbstractSchema.java +++ b/src/sqlancer/common/schema/AbstractSchema.java @@ -41,7 +41,12 @@ public A getRandomTableOrBailout() { } public A getRandomTable(Predicate predicate) { - return Randomly.fromList(getDatabaseTables().stream().filter(predicate).collect(Collectors.toList())); + List filtered = getDatabaseTables().stream().filter(predicate).collect(Collectors.toList()); + if (filtered.isEmpty()) { + throw new IgnoreMeException(); + } else { + return Randomly.fromList(filtered); + } } public A getRandomTableOrBailout(Function f) {