Skip to content

Commit

Permalink
Add OutOfMemoryError warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Scotsguy committed Dec 30, 2019
1 parent 866b66f commit f2e4067
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/parsers.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#![deny(dead_code)]

use lazy_static::lazy_static;
use log::warn;
use regex::Regex;

pub type Check = fn(&str) -> Option<(&str, String)>;

pub static PARSERS: [Check; 7] = [
pub static PARSERS: [Check; 8] = [
multimc_in_program_files,
server_java,
buildsystem_forge,
java_version,
id_range_exceeded,
out_of_memory_error,
java_architecture,
ram_amount,
];

use log::warn;

fn multimc_in_program_files(log: &str) -> Option<(&str, String)> {
const TRIGGER: &str = "Minecraft folder is:\nC:/Program Files";
if log.contains(TRIGGER) {
Expand Down Expand Up @@ -67,6 +67,14 @@ fn id_range_exceeded(log: &str) -> Option<(&str, String)> {
None
}
}
fn out_of_memory_error(log: &str) -> Option<(&str, String)> {
const TRIGGER: &str = "java.lang.OutOfMemoryError";
if log.contains(TRIGGER) {
Some(("‼", "You've run out of memory. You should allocate more, although the exact value depends on how many mods you have installed.".to_string()))
} else {
None
}
}

fn java_version(log: &str) -> Option<(&str, String)> {
lazy_static! {
Expand Down

0 comments on commit f2e4067

Please sign in to comment.