Commit 7ef0e941 authored by Laurent Wouters's avatar Laurent Wouters
Browse files

[fix] Fixed handling of undefined rendering target

parent 12ff4461aace
......@@ -268,8 +268,10 @@ export class RdfEntityStore {
* @param uri The URI
*/
public sym(uri: string): $rdf.NamedNode {
if (uri == null || uri == undefined || uri.length == 0) return null;
if (this.nodes.hasOwnProperty(uri)) return this.nodes[uri];
let result = this.store.sym(uri);
if (result == null) return null;
this.nodes[uri] = result;
return result;
}
......@@ -280,7 +282,9 @@ export class RdfEntityStore {
*/
public entityForUri(uri: string): RdfEntity {
if (this.entities.hasOwnProperty(uri)) return this.entities[uri];
let result = new RdfEntity(this, this.sym(uri));
let node = this.sym(uri);
if (node == null) return null;
let result = new RdfEntity(this, node);
this.entities[uri] = result;
this.resolveAliases(result);
return result;
......@@ -291,6 +295,7 @@ export class RdfEntityStore {
* @param node The named node
*/
public entityForNN(node: $rdf.NamedNode): RdfEntity {
if (node == null || node == undefined) return null;
if (this.entities.hasOwnProperty(node.uri)) return this.entities[node.uri];
let result = new RdfEntity(this, node);
this.entities[node.uri] = result;
......
......@@ -86,7 +86,7 @@ class BookRendering implements implementation.ViewImplementation {
}
priorityFor(store: $rdf.Formula, target: string): number {
if (target == null) return -1;
if (target == null || target == undefined || target.length == 0) return -1;
let entityTarget = getMainEntity(store, target);
let entityTypes = entityTarget.getEntitiesForS(
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
......
......@@ -131,7 +131,7 @@ class PersonRendering implements implementation.ViewImplementation {
}
priorityFor(store: $rdf.Formula, target: string): number {
if (target == null) return -1;
if (target == null || target == undefined || target.length == 0) return -1;
let entityTarget = getMainEntity(store, target);
let entityTypes = entityTarget.getEntitiesForS(
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment