mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	don't allow setting image quality to empty value, #3894
This commit is contained in:
		@@ -10,7 +10,7 @@ function getOptionOrNull(name) {
 | 
			
		||||
        // e.g. in initial sync becca is not loaded because DB is not initialized
 | 
			
		||||
        option = sql.getRow("SELECT * FROM options WHERE name = ?", name);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    return option ? option.value : null;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -27,13 +27,17 @@ function getOption(name) {
 | 
			
		||||
/**
 | 
			
		||||
 * @returns {number}
 | 
			
		||||
 */
 | 
			
		||||
function getOptionInt(name) {
 | 
			
		||||
function getOptionInt(name, defaultValue = undefined) {
 | 
			
		||||
    const val = getOption(name);
 | 
			
		||||
 | 
			
		||||
    const intVal = parseInt(val);
 | 
			
		||||
 | 
			
		||||
    if (isNaN(intVal)) {
 | 
			
		||||
        throw new Error(`Could not parse "${val}" into integer for option "${name}"`);
 | 
			
		||||
        if (defaultValue === undefined) {
 | 
			
		||||
            throw new Error(`Could not parse "${val}" into integer for option "${name}"`);
 | 
			
		||||
        } else {
 | 
			
		||||
            return defaultValue;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return intVal;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user