Skip to content

fix(core): add null checks for dev menu logs #2332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ public void setOnHideAction(HideAction action) {
* @return the stored logs as a String.
*/
public String getLogs() {
if (loggingPlugin == null) {
return "No logs to display.";
}
List<LogEntry> logs = loggingPlugin.getLogs();
if (logs.isEmpty()) {
return "No logs to display.";
Expand All @@ -143,6 +146,9 @@ public String getLogs() {
* @return the stored logs as a String.
*/
public String getFilteredLogs(@Nullable String searchText, @Nullable LogLevel logLevel) {
if (loggingPlugin == null) {
return "No logs to display.";
}
if (Empty.check(searchText) && logLevel == null) {
return getLogs();
}
Expand Down Expand Up @@ -184,7 +190,7 @@ public String createIssueBody(String description, boolean includeLogs) {
}
String deviceInfo = new DeviceInfo().toString();
String logsText = "";
if (includeLogs && !loggingPlugin.getLogs().isEmpty()) {
if (includeLogs && loggingPlugin != null && !loggingPlugin.getLogs().isEmpty()) {
logsText = "**Logs**\n```\n" + getLogs() + "```";
}
return String.format(Locale.US, "**Issue Description**\n%s\n\n**Environment Information**\n%s\n\n" +
Expand Down