fix error loading bad file
This commit is contained in:
parent
efe4a48d8f
commit
ca6a46421d
|
@ -81,6 +81,7 @@ public class Pluie.Yaml.Config
|
||||||
this.display_file = display_file;
|
this.display_file = display_file;
|
||||||
if (this.path != null) {
|
if (this.path != null) {
|
||||||
this.loader = new Yaml.Loader (this.path, display_file, false);
|
this.loader = new Yaml.Loader (this.path, display_file, false);
|
||||||
|
if (this.loader.done) {
|
||||||
Yaml.Node? root = this.loader.get_nodes ();
|
Yaml.Node? root = this.loader.get_nodes ();
|
||||||
if (root != null) {
|
if (root != null) {
|
||||||
this.finder = new Yaml.Finder(root);
|
this.finder = new Yaml.Finder(root);
|
||||||
|
@ -88,6 +89,7 @@ public class Pluie.Yaml.Config
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* find node matching specifiyed keyPath
|
* find node matching specifiyed keyPath
|
||||||
|
@ -105,9 +107,9 @@ public class Pluie.Yaml.Config
|
||||||
/**
|
/**
|
||||||
* retriew the corresponding Yaml.Root node for loaded yaml file
|
* retriew the corresponding Yaml.Root node for loaded yaml file
|
||||||
*/
|
*/
|
||||||
public Yaml.Root root_node ()
|
public Yaml.Root? root_node ()
|
||||||
{
|
{
|
||||||
return this.finder.context as Yaml.Root;
|
return this.finder!=null ? this.finder.context as Yaml.Root : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -61,6 +61,7 @@ public class Pluie.Yaml.Loader
|
||||||
public Loader (string path, bool display_file = false, bool displayNode = false )
|
public Loader (string path, bool display_file = false, bool displayNode = false )
|
||||||
{
|
{
|
||||||
this.reader = new Io.Reader (path);
|
this.reader = new Io.Reader (path);
|
||||||
|
if (this.reader.readable) {
|
||||||
this.scanner = new Yaml.Scanner (path);
|
this.scanner = new Yaml.Scanner (path);
|
||||||
if (display_file) this.display_file ();
|
if (display_file) this.display_file ();
|
||||||
|
|
||||||
|
@ -77,6 +78,7 @@ public class Pluie.Yaml.Loader
|
||||||
this.display_file (evt.line);
|
this.display_file (evt.line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return resulting Yaml root node
|
* return resulting Yaml root node
|
||||||
|
|
Loading…
Reference in New Issue
Block a user